Rev 1834 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1832 | yogev_ezra | 1 | ; compiler: FASM 1.67.21 |
2296 | leency | 2 | ; name: ICQ client for Kolibri |
3 | ; version: 0.1.30 |
||
1832 | yogev_ezra | 4 | ; written by: LV |
2296 | leency | 5 | ; e-mail: lv4evil@yandex.ru |
1832 | yogev_ezra | 6 | |
7 | |||
8 | include "lang.inc" |
||
2296 | leency | 9 | include "MACROS.INC" |
10 | ;purge mov |
||
1832 | yogev_ezra | 11 | ;include "ASCL9/ascl.inc" |
12 | ;include "debug.inc" |
||
2296 | leency | 13 | include "editbox.inc" |
1832 | yogev_ezra | 14 | |
15 | MEOS_APP_START |
||
16 | |||
17 | ;include "debug.inc" |
||
18 | include "2000.inc" |
||
19 | include "comp.inc" |
||
2296 | leency | 20 | ;include "fsio.inc" |
21 | include "dos2win.inc" |
||
22 | include "parser.inc" |
||
23 | include "ssi.inc" |
||
1832 | yogev_ezra | 24 | |
25 | use_edit_box procinfo,22,5 |
||
26 | |||
2296 | leency | 27 | ; |
28 | ; Если == 0, код для использования контакт листа |
||
29 | ; на сервере не ассемблируется |
||
30 | ; |
||
31 | USE_SSI = 1 |
||
32 | ; |
||
33 | ; |
||
34 | |||
1832 | yogev_ezra | 35 | CODE |
36 | |||
37 | |||
38 | ;mov eax, 40 |
||
39 | ;mov ebx, 47h |
||
40 | ;int 40h |
||
2296 | leency | 41 | |
42 | ; |
||
43 | ; Загрузка конфигов |
||
44 | ; |
||
45 | |||
46 | mov eax, fname |
||
47 | call parseconf |
||
48 | ; |
||
49 | ; Вывод загруженной информации |
||
50 | ; |
||
51 | |||
52 | mov eax, cfg_message |
||
53 | xor ebx, ebx |
||
54 | call writemsg |
||
55 | |||
56 | call showcfg |
||
57 | |||
1832 | yogev_ezra | 58 | |
2296 | leency | 59 | ;call loaduin |
1832 | yogev_ezra | 60 | call draw_window ; at first create and draw the window |
61 | |||
62 | ;call buttonbox |
||
63 | |||
64 | wait_event: ; main cycle |
||
2296 | leency | 65 | ;mov eax, 23 |
66 | ;mov ebx, 20 |
||
67 | ;int 0x40 |
||
68 | mcall 23,20 |
||
1832 | yogev_ezra | 69 | |
70 | cmp eax, 1 ; if event == 1 |
||
71 | je redraw ; jump to redraw handler |
||
72 | cmp eax, 2 ; else if event == 2 |
||
73 | je key ; jump to key handler |
||
74 | cmp eax, 3 ; else if event == 3 |
||
75 | je button ; jump to button handler |
||
76 | |||
77 | ; |
||
78 | ; Ждем данных |
||
79 | ; |
||
2296 | leency | 80 | |
81 | mcall 53,2,[socket] |
||
1832 | yogev_ezra | 82 | cmp eax, 0 |
83 | jnz read_socket |
||
84 | |||
85 | mouse_edit_box inputbox |
||
86 | ; |
||
87 | ; Если есть соединение с сервером, посылаем пакеты - подтвеждения каждые 60 с |
||
2296 | leency | 88 | ; не требуется |
89 | ; call sendkeep |
||
1832 | yogev_ezra | 90 | |
91 | jmp wait_event ; else return to the start of main cycle |
||
92 | |||
93 | |||
94 | redraw: ; redraw event handler |
||
95 | call draw_window |
||
96 | jmp wait_event |
||
97 | |||
98 | |||
2296 | leency | 99 | key: ; get key code |
100 | |||
101 | mcall 2 |
||
1832 | yogev_ezra | 102 | |
2296 | leency | 103 | cmp ah, 0Dh ; Пробел - отправить сообщение |
1832 | yogev_ezra | 104 | jz send |
105 | |||
106 | |||
107 | key_edit_box inputbox |
||
108 | |||
109 | jmp wait_event |
||
110 | |||
111 | |||
112 | button: ; button event handler |
||
2296 | leency | 113 | ;mov eax, 17 ; get button identifier |
114 | ;int 0x40 |
||
115 | mcall 17 |
||
1832 | yogev_ezra | 116 | |
117 | cmp ah, 2 |
||
2296 | leency | 118 | jz connect |
1832 | yogev_ezra | 119 | |
120 | cmp ah, 3 |
||
2296 | leency | 121 | jz disconnect |
1832 | yogev_ezra | 122 | |
123 | cmp ah, 4 |
||
2296 | leency | 124 | jz send |
1832 | yogev_ezra | 125 | |
126 | ; |
||
127 | ; Проверяем, не нажата ли кнопка в КЛ |
||
128 | ; 100 |
||
129 | cmp ah, UINS+100 |
||
130 | jnc @f |
||
131 | cmp ah, 100 |
||
132 | jc @f |
||
133 | ; |
||
134 | ; Нажата |
||
135 | ; |
||
136 | sub ah, 100 |
||
137 | mov [curruser], ah |
||
138 | ; |
||
139 | ; Выводим строчку, кому |
||
140 | ; |
||
141 | shr eax, 8 |
||
142 | and eax, 000000FFh |
||
143 | push eax |
||
144 | mov eax, CUSER |
||
145 | call strlen |
||
146 | mov ecx, eax |
||
147 | mov eax, CUSER |
||
148 | mov ebx, buff |
||
149 | call strcpy |
||
150 | pop eax |
||
151 | mov ebx, NAME_LEN |
||
152 | imul ebx, eax |
||
2296 | leency | 153 | lea eax, [names + ebx] |
154 | mov [buff + ecx], ' ' ; Пробел |
||
155 | lea ebx, [buff + ecx + 1] |
||
1832 | yogev_ezra | 156 | mov ecx, NAME_LEN |
2296 | leency | 157 | ;debug |
158 | push ebx |
||
159 | mov ebx, NAME_LEN |
||
160 | call print_mem |
||
161 | pop ebx |
||
162 | ; |
||
1832 | yogev_ezra | 163 | call strcpy |
164 | mov eax, buff |
||
165 | xor ebx, ebx |
||
166 | call writemsg |
||
167 | |||
168 | |||
169 | |||
170 | |||
171 | @@: |
||
172 | cmp ah, 1 |
||
173 | jne wait_event ; return if button id != 1 |
||
174 | |||
2296 | leency | 175 | ; exit application |
176 | mcall -1 |
||
1832 | yogev_ezra | 177 | |
178 | |||
179 | draw_window: |
||
2296 | leency | 180 | ; start drawing |
181 | mcall 12,1 |
||
1832 | yogev_ezra | 182 | |
2296 | leency | 183 | mcall 0,(100*65536+700),(100*65536+500),0x14ffffff,0,head |
1832 | yogev_ezra | 184 | |
185 | draw_edit_box inputbox |
||
186 | |||
187 | rect 10, 30, 500, 450, 0 |
||
188 | |||
189 | draw_button 600, 460, 60, 15, 2, 'CONNECT' |
||
190 | ;draw_button 600, 460, 60, 15, 3, 'Disconnect' |
||
191 | draw_button 530, 460, 60, 15, 4, 'SEND' |
||
192 | |||
2296 | leency | 193 | call printbuff |
1832 | yogev_ezra | 194 | call buttonbox |
2296 | leency | 195 | |
196 | ; |
||
197 | ; Image |
||
198 | ; |
||
199 | ;mov eax, 7 |
||
200 | ;mov ebx, redicq |
||
201 | ;mov ecx, 15*65536+15 |
||
202 | ;mov edx, 100*65536+100 |
||
203 | ;int 40h |
||
204 | |||
205 | |||
1832 | yogev_ezra | 206 | |
207 | |||
2296 | leency | 208 | ; finish drawing |
209 | mcall 12,2 |
||
1832 | yogev_ezra | 210 | |
211 | ret |
||
212 | |||
213 | ; |
||
214 | ; Соединение |
||
215 | ; |
||
216 | connect: |
||
2296 | leency | 217 | lea eax, [vtable + vartable.icqip] |
218 | call ip_parser |
||
219 | call htonl |
||
220 | data_debug 'IP:', eax |
||
221 | |||
222 | ;mov eax, ICQ_IP |
||
1832 | yogev_ezra | 223 | mov ebx, ICQ_PORT |
224 | call srv_connect |
||
2296 | leency | 225 | |
1832 | yogev_ezra | 226 | |
227 | |||
228 | jmp wait_event |
||
229 | |||
230 | |||
231 | ; |
||
232 | ; |
||
233 | ; |
||
234 | disconnect: |
||
235 | mov ecx, [socket] |
||
236 | call closesocket |
||
237 | |||
238 | jmp wait_event |
||
239 |