Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; IRC CLIENT for MenuetOS ;; |
||
4 | ;; ;; |
||
5 | ;; License: GPL / See file COPYING for details ;; |
||
6 | ;; Copyright 2004 (c) Ville Turjanmaa ;; |
||
7 | ;; ;; |
||
8 | ;; Compile with FASM for Menuet ;; |
||
9 | ;; ;; |
||
10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
11 | |||
485 | heavyiron | 12 | version equ '0.5' |
31 | halyavin | 13 | |
485 | heavyiron | 14 | |
15 | ;__DEBUG__ equ 1 |
||
16 | ;__DEBUG_LEVEL__ equ 1 |
||
17 | |||
31 | halyavin | 18 | use32 |
19 | |||
195 | heavyiron | 20 | org 0x0 |
31 | halyavin | 21 | |
195 | heavyiron | 22 | db 'MENUET01' ; 8 byte id |
23 | dd 0x01 ; required os |
||
24 | dd START ; program start |
||
25 | dd I_END ; program image size |
||
26 | dd 0x100000 ; required amount of memory |
||
27 | dd 0x100000 |
||
28 | dd 0,0 |
||
29 | |||
485 | heavyiron | 30 | include "..\..\..\macros.inc" |
31 | ;include "fdo.inc" |
||
32 | include "eth.inc" |
||
33 | ;include "lang.inc" |
||
31 | halyavin | 34 | |
195 | heavyiron | 35 | irc_server_ip db 83,149,74,246 ;server: kolibrios.org |
31 | halyavin | 36 | |
195 | heavyiron | 37 | user_nick dd 12 ; length |
38 | db 'kolibri_user ' ; string |
||
31 | halyavin | 39 | |
195 | heavyiron | 40 | user_real_name dd 14 ; length |
41 | db 'KolibriOS User ' ; string |
||
31 | halyavin | 42 | |
43 | |||
195 | heavyiron | 44 | START: ; start of execution |
31 | halyavin | 45 | |
46 | mov eax,40 |
||
47 | mov ebx,10000111b |
||
485 | heavyiron | 48 | mcall |
31 | halyavin | 49 | |
50 | mov edi,I_END |
||
51 | mov ecx,60*120 |
||
52 | mov eax,32 |
||
53 | cld |
||
54 | rep stosb |
||
55 | |||
56 | mov eax,[rxs] |
||
57 | imul eax,11 |
||
58 | mov [pos],eax |
||
59 | |||
60 | mov ebp,0 |
||
61 | mov edx,I_END |
||
195 | heavyiron | 62 | call draw_window ; at first, draw the window |
31 | halyavin | 63 | |
64 | still: |
||
65 | |||
66 | inc [cursor_on_off] |
||
67 | |||
68 | mov eax,5 |
||
69 | mov ebx,1 |
||
485 | heavyiron | 70 | mcall |
31 | halyavin | 71 | |
195 | heavyiron | 72 | mov eax,11 ; wait here for event |
485 | heavyiron | 73 | mcall |
31 | halyavin | 74 | |
75 | call print_status |
||
76 | |||
195 | heavyiron | 77 | cmp eax,1 ; redraw |
78 | je redraw |
||
79 | cmp eax,2 ; key |
||
80 | je main_window_key |
||
81 | cmp eax,3 ; button |
||
82 | je button |
||
31 | halyavin | 83 | |
84 | cmp [I_END+120*60],byte 1 |
||
85 | jne no_main_update |
||
86 | mov [I_END+120*60],byte 0 |
||
87 | mov edx,I_END |
||
88 | call draw_channel_text |
||
89 | no_main_update: |
||
90 | |||
91 | call read_incoming_data |
||
92 | |||
93 | call send_data_to_server |
||
94 | |||
95 | test [cursor_on_off],0x3f |
||
96 | jnz nopri |
||
97 | inc [blink] |
||
98 | call blink_cursor |
||
99 | call print_channel_list |
||
100 | nopri: |
||
101 | |||
102 | jmp still |
||
103 | |||
104 | |||
195 | heavyiron | 105 | redraw: ; redraw |
31 | halyavin | 106 | |
107 | call draw_window |
||
108 | jmp still |
||
109 | |||
110 | |||
195 | heavyiron | 111 | button: ; button |
31 | halyavin | 112 | |
195 | heavyiron | 113 | mov eax,17 ; get id |
485 | heavyiron | 114 | mcall |
31 | halyavin | 115 | |
195 | heavyiron | 116 | cmp ah,1 ; close program |
31 | halyavin | 117 | jne noclose |
118 | mov eax,-1 |
||
485 | heavyiron | 119 | mcall |
31 | halyavin | 120 | noclose: |
121 | |||
122 | call socket_commands |
||
123 | |||
124 | jmp still |
||
125 | |||
126 | |||
127 | print_status: |
||
128 | |||
129 | pusha |
||
130 | |||
131 | mov eax,53 |
||
132 | mov ebx,6 |
||
133 | mov ecx,[socket] |
||
485 | heavyiron | 134 | mcall |
31 | halyavin | 135 | |
136 | mov [status],eax |
||
137 | |||
138 | cmp [old_status],eax |
||
195 | heavyiron | 139 | je nopr |
31 | halyavin | 140 | |
141 | mov [old_status],eax |
||
142 | |||
143 | push eax |
||
144 | |||
145 | mov eax,13 |
||
146 | mov ebx,450*65536+30 |
||
147 | mov ecx,231*65536+10 |
||
148 | mov edx,0xffffff |
||
485 | heavyiron | 149 | mcall |
31 | halyavin | 150 | |
151 | pop ecx |
||
152 | mov eax,47 |
||
153 | mov ebx,2*65536 |
||
154 | mov edx,450*65536+231 |
||
155 | mov esi,0x000000 |
||
485 | heavyiron | 156 | mcall |
31 | halyavin | 157 | |
158 | nopr: |
||
159 | |||
160 | popa |
||
161 | |||
162 | ret |
||
163 | |||
164 | status dd 0 |
||
165 | old_status dd 0 |
||
166 | |||
167 | |||
168 | socket_commands: |
||
169 | |||
195 | heavyiron | 170 | cmp ah,22 ; open socket |
31 | halyavin | 171 | jnz tst3 |
172 | mov eax,3 |
||
485 | heavyiron | 173 | mcall |
31 | halyavin | 174 | mov ecx,eax |
175 | mov eax,53 |
||
176 | mov ebx,5 |
||
177 | mov edx,6667 |
||
178 | mov esi,dword [irc_server_ip] |
||
179 | mov edi,1 |
||
485 | heavyiron | 180 | mcall |
31 | halyavin | 181 | mov [socket], eax |
182 | ret |
||
183 | tst3: |
||
184 | |||
185 | |||
195 | heavyiron | 186 | cmp ah,23 ; write userinfo |
31 | halyavin | 187 | jnz tst4 |
188 | |||
189 | mov eax,53 ; user |
||
190 | mov ebx,7 |
||
191 | mov ecx,[socket] |
||
192 | mov edx,string0l-string0 |
||
193 | mov esi,string0 |
||
485 | heavyiron | 194 | mcall |
31 | halyavin | 195 | |
196 | mov eax,53 ; |
||
197 | mov ebx,7 |
||
198 | mov ecx,[socket] |
||
199 | mov edx,[user_real_name] |
||
200 | mov esi,user_real_name+4 |
||
485 | heavyiron | 201 | mcall |
31 | halyavin | 202 | |
203 | mov eax,53 ; |
||
204 | mov ebx,7 |
||
205 | mov ecx,[socket] |
||
206 | mov edx,2 |
||
207 | mov esi,line_feed |
||
485 | heavyiron | 208 | mcall |
31 | halyavin | 209 | |
210 | |||
211 | mov eax,5 |
||
212 | mov ebx,10 |
||
485 | heavyiron | 213 | mcall |
31 | halyavin | 214 | |
215 | mov eax,53 ; nick |
||
216 | mov ebx,7 |
||
217 | mov ecx,[socket] |
||
218 | mov edx,string1l-string1 |
||
219 | mov esi,string1 |
||
485 | heavyiron | 220 | mcall |
31 | halyavin | 221 | |
222 | mov eax,53 ; |
||
223 | mov ebx,7 |
||
224 | mov ecx,[socket] |
||
225 | mov edx,[user_nick] |
||
226 | mov esi,user_nick+4 |
||
485 | heavyiron | 227 | mcall |
31 | halyavin | 228 | |
229 | mov eax,53 ; |
||
230 | mov ebx,7 |
||
231 | mov ecx,[socket] |
||
232 | mov edx,2 |
||
233 | mov esi,line_feed |
||
485 | heavyiron | 234 | mcall |
31 | halyavin | 235 | |
236 | |||
237 | ret |
||
238 | |||
239 | line_feed: db 13,10 |
||
240 | |||
241 | tst4: |
||
242 | |||
243 | |||
195 | heavyiron | 244 | cmp ah,24 ; close socket |
31 | halyavin | 245 | jnz no_24 |
246 | mov eax,53 |
||
247 | mov ebx,8 |
||
248 | mov ecx,[socket] |
||
485 | heavyiron | 249 | mcall |
31 | halyavin | 250 | ret |
251 | no_24: |
||
252 | |||
253 | |||
254 | ret |
||
255 | |||
256 | |||
257 | main_window_key: |
||
258 | |||
259 | mov eax,2 |
||
485 | heavyiron | 260 | mcall |
31 | halyavin | 261 | |
262 | shr eax,8 |
||
263 | |||
264 | cmp eax,8 |
||
265 | jne no_bks2 |
||
266 | cmp [xpos],0 |
||
195 | heavyiron | 267 | je still |
31 | halyavin | 268 | dec [xpos] |
269 | call print_entry |
||
270 | jmp still |
||
271 | no_bks2: |
||
272 | |||
273 | cmp eax,20 |
||
274 | jbe no_character2 |
||
275 | mov ebx,[xpos] |
||
276 | mov [send_string+ebx],al |
||
277 | inc [xpos] |
||
278 | cmp [xpos],80 |
||
195 | heavyiron | 279 | jb noxposdec |
31 | halyavin | 280 | mov [xpos],79 |
281 | noxposdec: |
||
282 | call print_entry |
||
283 | jmp still |
||
284 | no_character2: |
||
285 | |||
286 | cmp eax,13 |
||
287 | jne no_send |
||
288 | cmp [xpos],0 |
||
195 | heavyiron | 289 | je no_send2 |
31 | halyavin | 290 | cmp [send_string],byte '/' ; server command |
291 | jne no_send2 |
||
292 | mov [send_to_server],1 |
||
293 | jmp still |
||
294 | no_send2: |
||
295 | |||
296 | jmp still |
||
297 | |||
298 | |||
299 | print_channel_list: |
||
300 | |||
301 | pusha |
||
302 | |||
303 | mov eax,13 |
||
304 | mov ebx,415*65536+6*13 |
||
305 | mov ecx,27*65536+12*10 |
||
306 | mov edx,0xffffff |
||
485 | heavyiron | 307 | mcall |
31 | halyavin | 308 | |
309 | mov eax,4 |
||
310 | mov ebx,415*65536+27 |
||
311 | mov ecx,[index_list_1] |
||
312 | mov edx,channel_list+32 |
||
313 | newch: |
||
314 | movzx esi,byte [edx+31] |
||
315 | and esi,0x1f |
||
485 | heavyiron | 316 | mcall |
31 | halyavin | 317 | add edx,32 |
318 | add ebx,12 |
||
319 | cmp edx,channel_list+32*10 |
||
320 | jbe newch |
||
321 | |||
322 | no_channel_list: |
||
323 | |||
324 | popa |
||
325 | |||
326 | ret |
||
327 | |||
328 | |||
329 | print_user_list: |
||
330 | |||
331 | pusha |
||
332 | |||
333 | newtry: |
||
334 | |||
335 | mov edx,ebp |
||
336 | imul edx,120*80 |
||
337 | add edx,120*60+8+I_END |
||
338 | cmp [edx],byte 1 |
||
195 | heavyiron | 339 | je nonp |
31 | halyavin | 340 | |
341 | mov edx,ebp |
||
342 | imul edx,120*80 |
||
343 | add edx,120*70+I_END |
||
344 | mov edi,edx |
||
345 | |||
346 | mov eax,[edx-8] |
||
347 | mov ebx,[edx-4] |
||
348 | add ebx,edx |
||
349 | sub ebx,3 |
||
350 | inc eax |
||
351 | dec edx |
||
352 | newnss: |
||
353 | inc edx |
||
354 | dec eax |
||
195 | heavyiron | 355 | jz startuu |
31 | halyavin | 356 | asdf: |
357 | cmp [edx],word ' ' |
||
358 | jne nodouble |
||
359 | inc edx |
||
360 | nodouble: |
||
361 | cmp [edx],byte ' ' |
||
195 | heavyiron | 362 | je newnss |
31 | halyavin | 363 | inc edx |
364 | cmp edx,ebx |
||
365 | jbe asdf |
||
366 | dec dword [edi-8] |
||
367 | |||
368 | popa |
||
369 | ret |
||
370 | |||
371 | startuu: |
||
372 | |||
373 | cmp [edx],byte ' ' |
||
374 | jne startpr |
||
375 | inc edx |
||
376 | startpr: |
||
377 | |||
378 | pusha |
||
379 | mov eax,13 |
||
380 | mov ebx,415*65536+6*13 |
||
381 | mov ecx,27*65536+12*10 |
||
382 | mov edx,0xffffff |
||
485 | heavyiron | 383 | mcall |
31 | halyavin | 384 | popa |
385 | |||
386 | mov eax,4 |
||
387 | mov ebx,415*65536+27 |
||
388 | |||
389 | mov ebp,0 |
||
390 | newuser: |
||
391 | |||
392 | mov esi,0 |
||
393 | newusers: |
||
394 | cmp [edx+esi],byte ' ' |
||
195 | heavyiron | 395 | je do_print |
31 | halyavin | 396 | inc esi |
397 | cmp esi,20 |
||
398 | jbe newusers |
||
399 | do_print: |
||
400 | |||
401 | mov ecx,[index_list_1] |
||
402 | cmp [edx],byte '@' |
||
403 | jne no_op |
||
404 | mov ecx,[index_list_2] |
||
405 | no_op: |
||
406 | |||
485 | heavyiron | 407 | mcall |
31 | halyavin | 408 | |
409 | inc ebp |
||
410 | cmp ebp,10 |
||
195 | heavyiron | 411 | je nonp |
31 | halyavin | 412 | |
413 | add ebx,12 |
||
414 | |||
415 | add edx,esi |
||
416 | |||
417 | inc edx |
||
418 | cmp [edx],byte ' ' |
||
419 | jne newuser |
||
420 | inc edx |
||
421 | jmp newuser |
||
422 | |||
423 | nonp: |
||
424 | |||
425 | popa |
||
426 | |||
427 | ret |
||
428 | |||
429 | |||
430 | start_user_list_at dd 0x0 |
||
431 | |||
432 | |||
195 | heavyiron | 433 | recode_to_cp1251: |
434 | push esi edx |
||
435 | .loop: |
||
436 | lodsb |
||
437 | cmp al,0x80 |
||
438 | jb @f |
||
439 | and eax,0x7F |
||
440 | mov al,[cp866_table+eax] |
||
441 | @@: mov [esi-1],al |
||
442 | dec edx |
||
443 | jnz .loop |
||
444 | pop edx esi |
||
445 | ret |
||
31 | halyavin | 446 | |
447 | |||
448 | send_data_to_server: |
||
449 | |||
450 | pusha |
||
451 | |||
452 | cmp [send_to_server],1 |
||
453 | jne sdts_ret |
||
454 | |||
455 | mov eax,[xpos] |
||
456 | mov [send_string+eax+0],byte 13 |
||
457 | mov [send_string+eax+1],byte 10 |
||
458 | |||
459 | mov eax,[rxs] |
||
460 | imul eax,11 |
||
461 | mov [pos],eax |
||
462 | mov eax,[send_to_channel] |
||
463 | imul eax,120*80 |
||
464 | add eax,I_END |
||
465 | mov [text_start],eax |
||
466 | |||
467 | cmp [send_string],byte '/' ; server command |
||
195 | heavyiron | 468 | je server_command |
31 | halyavin | 469 | |
470 | mov bl,13 |
||
471 | call print_character |
||
472 | mov bl,10 |
||
473 | call print_character |
||
474 | mov bl,'<' |
||
475 | call print_character |
||
476 | |||
477 | mov esi,user_nick+4 |
||
478 | mov ecx,[user_nick] |
||
479 | newnp: |
||
480 | mov bl,[esi] |
||
481 | call print_character |
||
482 | inc esi |
||
483 | loop newnp |
||
484 | |||
485 | mov bl,'>' |
||
486 | call print_character |
||
487 | mov bl,' ' |
||
488 | call print_character |
||
489 | |||
490 | mov ecx,[xpos] |
||
491 | mov esi,send_string |
||
492 | newcw: |
||
493 | mov bl,[esi] |
||
494 | call print_character |
||
495 | inc esi |
||
496 | loop newcw |
||
497 | |||
498 | mov eax,dword [send_to_channel] |
||
499 | shl eax,5 |
||
500 | add eax,channel_list |
||
501 | mov esi,eax |
||
502 | |||
503 | mov edi,send_string_header+8 |
||
504 | movzx ecx,byte [eax+31] |
||
505 | cld |
||
506 | rep movsb |
||
507 | |||
508 | mov [edi],word ' :' |
||
509 | |||
510 | mov esi, send_string_header |
||
511 | mov edx,10 |
||
512 | movzx ebx,byte [eax+31] |
||
513 | add edx,ebx |
||
514 | |||
515 | mov eax, 53 ; write channel |
||
516 | mov ebx, 7 |
||
517 | mov ecx, [socket] |
||
485 | heavyiron | 518 | mcall |
31 | halyavin | 519 | |
520 | mov esi,send_string |
||
521 | mov edx,[xpos] |
||
522 | inc edx |
||
523 | |||
195 | heavyiron | 524 | call recode_to_cp1251 |
525 | |||
31 | halyavin | 526 | mov eax, 53 ; write message |
527 | mov ebx, 7 |
||
528 | mov ecx, [socket] |
||
485 | heavyiron | 529 | mcall |
31 | halyavin | 530 | |
531 | jmp send_done |
||
532 | |||
533 | server_command: |
||
534 | |||
535 | cmp [send_string+1],dword 'anic' |
||
536 | jne no_set_nick |
||
537 | |||
538 | mov ecx,[xpos] |
||
539 | sub ecx,7 |
||
540 | mov [user_nick],ecx |
||
541 | |||
542 | mov esi,send_string+7 |
||
543 | mov edi,user_nick+4 |
||
544 | cld |
||
545 | rep movsb |
||
546 | |||
547 | pusha |
||
548 | mov edi,text+70*1+15 |
||
549 | mov eax,32 |
||
550 | mov ecx,15 |
||
551 | cld |
||
552 | rep stosb |
||
553 | popa |
||
554 | |||
555 | mov esi,user_nick+4 |
||
556 | mov edi,text+70*1+15 |
||
557 | mov ecx,[user_nick] |
||
558 | cld |
||
559 | rep movsb |
||
560 | |||
561 | call draw_window |
||
562 | |||
563 | mov [xpos],0 |
||
564 | mov [send_to_server],0 |
||
565 | |||
566 | popa |
||
567 | ret |
||
568 | |||
569 | no_set_nick: |
||
570 | |||
571 | cmp [send_string+1],dword 'area' |
||
572 | jne no_set_real_name |
||
573 | |||
574 | mov ecx,[xpos] |
||
575 | sub ecx,7 |
||
576 | mov [user_real_name],ecx |
||
577 | |||
578 | mov esi,send_string+7 |
||
579 | mov edi,user_real_name+4 |
||
580 | cld |
||
581 | rep movsb |
||
582 | |||
583 | pusha |
||
584 | mov edi,text+70*0+15 |
||
585 | mov eax,32 |
||
586 | mov ecx,15 |
||
587 | cld |
||
588 | rep stosb |
||
589 | popa |
||
590 | |||
591 | mov esi,user_real_name+4 |
||
592 | mov edi,text+70*0+15 |
||
593 | mov ecx,[xpos] |
||
594 | sub ecx,7 |
||
595 | cld |
||
596 | rep movsb |
||
597 | |||
598 | call draw_window |
||
599 | |||
600 | mov [xpos],0 |
||
601 | mov [send_to_server],0 |
||
602 | |||
603 | popa |
||
604 | ret |
||
605 | |||
606 | no_set_real_name: |
||
607 | |||
608 | cmp [send_string+1],dword 'aser' |
||
609 | jne no_set_server |
||
610 | |||
485 | heavyiron | 611 | ; pusha |
612 | ; mov edi,irc_server_ip |
||
613 | ; mov esi,send_string+7 |
||
614 | ; mov eax,0 |
||
615 | ; mov edx,[xpos] |
||
616 | ; add edx,send_string-1 |
||
617 | ; newsip: |
||
618 | ; cmp [esi],byte '.' |
||
619 | ; je sipn |
||
620 | ; cmp esi,edx |
||
621 | ; jg sipn |
||
622 | ; movzx ebx,byte [esi] |
||
623 | ; inc esi |
||
624 | ; imul eax,10 |
||
625 | ; sub ebx,48 |
||
626 | ; add eax,ebx |
||
627 | ; jmp newsip |
||
628 | ; sipn: |
||
629 | ; mov [edi],al |
||
630 | ; xor eax,eax |
||
631 | ; inc esi |
||
632 | ; cmp esi,send_string+30 |
||
633 | ; jg sipnn |
||
634 | ; inc edi |
||
635 | ; cmp edi,irc_server_ip+3 |
||
636 | ; jbe newsip |
||
637 | ; sipnn: |
||
638 | ; popa |
||
31 | halyavin | 639 | |
485 | heavyiron | 640 | pusha |
641 | mov eax,send_string |
||
642 | add eax,[xpos] |
||
643 | mov dword[eax],0 |
||
644 | resolve send_string+7,dword[irc_server_ip] |
||
645 | ;DEBUGF 1,'%u.%u.%u.%u\n',1[irc_server_ip],1[irc_server_ip+1],1[irc_server_ip+2],1[irc_server_ip+3] |
||
646 | popa |
||
647 | |||
31 | halyavin | 648 | mov ecx,[xpos] |
649 | sub ecx,7 |
||
650 | |||
651 | pusha |
||
652 | mov edi,text+70*2+15 |
||
653 | mov eax,32 |
||
654 | mov ecx,15 |
||
655 | cld |
||
656 | rep stosb |
||
657 | popa |
||
658 | |||
659 | mov esi,send_string+7 |
||
660 | mov edi,text+70*2+15 |
||
661 | cld |
||
662 | rep movsb |
||
663 | |||
664 | call draw_window |
||
665 | |||
666 | mov [xpos],0 |
||
667 | mov [send_to_server],0 |
||
668 | |||
669 | popa |
||
670 | ret |
||
671 | |||
672 | no_set_server: |
||
673 | |||
674 | |||
675 | |||
676 | |||
677 | cmp [send_string+1],dword 'quer' |
||
678 | jne no_query_create |
||
679 | |||
680 | mov edi,I_END+120*80 |
||
681 | mov eax,1 ; create channel window - search for empty slot |
||
682 | newse2: |
||
683 | mov ebx,eax |
||
684 | shl ebx,5 |
||
685 | cmp dword [channel_list+ebx],dword ' ' |
||
195 | heavyiron | 686 | je free_found2 |
31 | halyavin | 687 | add edi,120*80 |
688 | inc eax |
||
689 | cmp eax,[max_windows] |
||
195 | heavyiron | 690 | jb newse2 |
31 | halyavin | 691 | |
692 | free_found2: |
||
693 | |||
694 | mov edx,send_string+7 |
||
695 | |||
696 | mov ecx,[xpos] |
||
697 | sub ecx,7 |
||
698 | mov [channel_list+ebx+31],cl |
||
699 | |||
700 | call create_channel_name |
||
701 | |||
702 | push edi |
||
703 | push eax |
||
704 | mov [edi+120*60+8],byte 1 ; query window |
||
705 | mov eax,32 |
||
706 | mov ecx,120*60 |
||
707 | cld |
||
708 | rep stosb |
||
709 | pop eax |
||
710 | pop edi |
||
711 | |||
712 | ; eax has the free position |
||
713 | mov [thread_screen],edi |
||
714 | call create_channel_window |
||
715 | |||
716 | mov [xpos],0 |
||
717 | mov [send_to_server],0 |
||
718 | |||
719 | popa |
||
720 | ret |
||
721 | |||
722 | no_query_create: |
||
723 | |||
724 | |||
725 | mov esi, send_string+1 |
||
726 | mov edx, [xpos] |
||
727 | add edx,1 |
||
728 | |||
729 | mov eax, 53 ; write server command |
||
730 | mov ebx, 7 |
||
731 | mov ecx, [socket] |
||
485 | heavyiron | 732 | mcall |
31 | halyavin | 733 | |
734 | send_done: |
||
735 | |||
736 | mov [xpos],0 |
||
737 | mov [send_to_server],0 |
||
738 | |||
739 | cmp [send_string+1],dword 'quit' |
||
740 | jne no_quit_server |
||
741 | mov eax,5 |
||
742 | mov ebx,200 |
||
485 | heavyiron | 743 | mcall |
31 | halyavin | 744 | |
745 | mov eax, 53 ; close socket |
||
746 | mov ebx, 8 |
||
747 | mov ecx, [socket] |
||
485 | heavyiron | 748 | mcall |
31 | halyavin | 749 | |
750 | mov ecx,[max_windows] |
||
751 | mov edi,I_END |
||
752 | newclose: |
||
753 | mov [edi+120*60+4],byte 1 |
||
754 | add edi,120*80 |
||
755 | loop newclose |
||
756 | |||
757 | popa |
||
758 | ret |
||
759 | |||
760 | no_quit_server: |
||
761 | |||
762 | sdts_ret: |
||
763 | |||
764 | popa |
||
765 | ret |
||
766 | |||
767 | |||
768 | |||
769 | read_incoming_data: |
||
770 | |||
771 | pusha |
||
772 | |||
773 | read_new_byte: |
||
774 | |||
775 | call read_incoming_byte |
||
776 | cmp ecx,-1 |
||
195 | heavyiron | 777 | je no_data_in_buffer |
31 | halyavin | 778 | |
779 | cmp bl,10 |
||
780 | jne no_start_command |
||
781 | mov [cmd],1 |
||
782 | no_start_command: |
||
783 | |||
784 | cmp bl,13 |
||
785 | jne no_end_command |
||
786 | mov eax,[cmd] |
||
787 | mov [eax+command-2],byte 0 |
||
788 | call analyze_command |
||
789 | mov edi,command |
||
790 | mov ecx,250 |
||
791 | mov eax,0 |
||
792 | cld |
||
793 | rep stosb |
||
794 | mov [cmd],0 |
||
795 | no_end_command: |
||
796 | |||
797 | mov eax,[cmd] |
||
798 | cmp eax,512 |
||
799 | jge still |
||
800 | |||
801 | mov [eax+command-2],bl |
||
802 | inc [cmd] |
||
803 | |||
804 | jmp read_new_byte |
||
805 | |||
806 | no_data_in_buffer: |
||
807 | |||
808 | popa |
||
809 | |||
810 | ret |
||
811 | |||
812 | |||
813 | create_channel_name: |
||
814 | |||
815 | pusha |
||
816 | |||
817 | search_first_letter: |
||
818 | cmp [edx],byte ' ' |
||
819 | jne first_letter_found |
||
820 | inc edx |
||
821 | jmp search_first_letter |
||
822 | first_letter_found: |
||
823 | |||
824 | mov esi,edx |
||
825 | mov edi,channel_list |
||
826 | add edi,ebx |
||
827 | mov ecx,30 |
||
828 | xor eax,eax |
||
829 | newcase: |
||
830 | mov al,[esi] |
||
831 | cmp eax,'a' |
||
195 | heavyiron | 832 | jb nocdec |
31 | halyavin | 833 | cmp eax,'z' |
195 | heavyiron | 834 | jg nocdec |
31 | halyavin | 835 | sub al,97-65 |
836 | nocdec: |
||
837 | mov [edi],al |
||
838 | inc esi |
||
839 | inc edi |
||
840 | loop newcase |
||
841 | |||
842 | popa |
||
843 | |||
844 | ret |
||
845 | |||
846 | |||
847 | create_channel_window: |
||
848 | |||
849 | pusha |
||
850 | |||
851 | mov [cursor_on_off],0 |
||
852 | |||
853 | mov [thread_nro],eax |
||
854 | |||
855 | mov eax,51 |
||
856 | mov ebx,1 |
||
857 | mov ecx,channel_thread |
||
858 | mov edx,[thread_stack] |
||
485 | heavyiron | 859 | mcall |
31 | halyavin | 860 | |
861 | mov eax,5 |
||
862 | mov ebx,10 |
||
485 | heavyiron | 863 | mcall |
31 | halyavin | 864 | |
865 | add [thread_stack],0x4000 |
||
866 | add [thread_screen],120*80 |
||
867 | |||
868 | popa |
||
869 | |||
870 | ret |
||
871 | |||
872 | |||
873 | print_entry: |
||
874 | |||
875 | pusha |
||
876 | |||
877 | mov eax,13 |
||
878 | mov ebx,8*65536+6*80 |
||
879 | mov ecx,151*65536+13 |
||
880 | mov edx,0xffffff |
||
485 | heavyiron | 881 | mcall |
31 | halyavin | 882 | |
883 | mov eax,4 |
||
884 | mov ebx,8*65536+154 |
||
885 | mov ecx,0x000000 |
||
886 | mov edx,send_string |
||
887 | mov esi,[xpos] |
||
485 | heavyiron | 888 | mcall |
31 | halyavin | 889 | |
890 | popa |
||
891 | |||
892 | ret |
||
893 | |||
894 | blink dd 0x0 |
||
895 | |||
896 | blink_cursor: |
||
897 | |||
898 | pusha |
||
899 | |||
900 | mov eax,9 |
||
901 | mov ebx,0xe0000 |
||
902 | mov ecx,-1 |
||
485 | heavyiron | 903 | mcall |
31 | halyavin | 904 | |
905 | mov edx,[blink] |
||
906 | and edx,1 |
||
907 | sub edx,1 |
||
908 | and edx,0xffffff |
||
909 | ; mov edx,0 |
||
910 | |||
911 | cmp ax,word [0xe0000+4] |
||
912 | jne no_blink |
||
913 | |||
914 | call print_entry |
||
915 | |||
916 | mov ebx,[xpos] |
||
917 | imul ebx,6 |
||
918 | add ebx,8 |
||
919 | mov cx,bx |
||
920 | shl ebx,16 |
||
921 | mov bx,cx |
||
922 | mov ecx,151*65536+163 |
||
923 | mov eax,38 |
||
485 | heavyiron | 924 | mcall |
31 | halyavin | 925 | |
926 | popa |
||
927 | |||
928 | ret |
||
929 | |||
930 | no_blink: |
||
931 | |||
932 | mov eax,13 |
||
933 | mov ebx,8*65536+6*60 |
||
934 | mov ecx,151*65536+13 |
||
935 | mov edx,0xffffff |
||
485 | heavyiron | 936 | mcall |
31 | halyavin | 937 | |
938 | popa |
||
939 | |||
940 | ret |
||
941 | |||
942 | |||
943 | |||
944 | |||
945 | |||
946 | set_channel: |
||
947 | |||
948 | pusha |
||
949 | |||
950 | ; UPPER / LOWER CASE CHECK |
||
951 | |||
952 | mov esi,eax |
||
953 | mov edi,channel_temp |
||
954 | mov ecx,40 |
||
955 | xor eax,eax |
||
956 | newcase2: |
||
957 | mov al,[esi] |
||
958 | cmp eax,'#' |
||
195 | heavyiron | 959 | jb newcase_over2 |
31 | halyavin | 960 | cmp eax,'a' |
195 | heavyiron | 961 | jb nocdec2 |
31 | halyavin | 962 | cmp eax,'z' |
195 | heavyiron | 963 | jg nocdec2 |
31 | halyavin | 964 | sub al,97-65 |
965 | nocdec2: |
||
966 | mov [edi],al |
||
967 | inc esi |
||
968 | inc edi |
||
969 | loop newcase2 |
||
970 | newcase_over2: |
||
971 | sub edi,channel_temp |
||
972 | mov [channel_temp_length],edi |
||
973 | |||
974 | mov eax,channel_temp |
||
975 | |||
976 | mov [text_start],I_END+120*80 |
||
977 | mov ebx,channel_list+32 |
||
978 | mov eax,[eax] |
||
979 | |||
980 | mov edx,[channel_temp_length] |
||
981 | |||
982 | stcl1: |
||
983 | cmp dl,[ebx+31] |
||
984 | jne notfound |
||
985 | |||
986 | pusha |
||
987 | xor eax,eax |
||
988 | xor edx,edx |
||
989 | mov ecx,0 |
||
990 | stc4: |
||
991 | mov dl,[ebx+ecx] |
||
992 | mov al,[channel_temp+ecx] |
||
993 | cmp eax,edx |
||
994 | jne notfound2 |
||
995 | inc ecx |
||
996 | cmp ecx,[channel_temp_length] |
||
195 | heavyiron | 997 | jb stc4 |
31 | halyavin | 998 | popa |
999 | |||
1000 | jmp found |
||
1001 | |||
1002 | notfound2: |
||
1003 | popa |
||
1004 | |||
1005 | notfound: |
||
1006 | add [text_start],120*80 |
||
1007 | add ebx,32 |
||
1008 | cmp ebx,channel_list+19*32 |
||
195 | heavyiron | 1009 | jb stcl1 |
31 | halyavin | 1010 | |
1011 | mov [text_start],I_END |
||
1012 | |||
1013 | found: |
||
1014 | |||
1015 | popa |
||
1016 | |||
1017 | ret |
||
1018 | |||
1019 | |||
195 | heavyiron | 1020 | channel_temp: times 100 db 0 |
31 | halyavin | 1021 | channel_temp_length dd 0x0 |
1022 | |||
1023 | |||
1024 | |||
1025 | print_nick: |
||
1026 | |||
1027 | pusha |
||
1028 | |||
1029 | mov eax,command+1 |
||
1030 | mov dl,'!' |
||
1031 | call print_text |
||
1032 | |||
1033 | popa |
||
1034 | ret |
||
1035 | |||
1036 | |||
1037 | analyze_command: |
||
1038 | |||
1039 | pusha |
||
1040 | |||
1041 | mov [text_start],I_END |
||
1042 | mov ecx,[rxs] |
||
1043 | imul ecx,11 |
||
1044 | mov [pos],ecx |
||
1045 | |||
1046 | mov bl,13 |
||
1047 | ; call print_character |
||
1048 | mov bl,10 |
||
1049 | ; call print_character |
||
1050 | |||
1051 | mov ecx,[cmd] |
||
1052 | sub ecx,2 |
||
1053 | mov esi,command+0 |
||
1054 | newcmdc: |
||
1055 | mov bl,[esi] |
||
1056 | ; call print_character |
||
1057 | inc esi |
||
1058 | loop newcmdc |
||
1059 | |||
1060 | mov edx,I_END |
||
1061 | ; call draw_channel_text |
||
1062 | |||
1063 | cmp [cmd],20 |
||
1064 | jge cmd_len_ok |
||
1065 | |||
1066 | mov [cmd],0 |
||
1067 | |||
1068 | popa |
||
1069 | ret |
||
1070 | |||
1071 | |||
1072 | cmd_len_ok: |
||
1073 | |||
1074 | cmp [command],dword 'PING' ; ping response |
||
1075 | jne no_ping_responce |
||
1076 | |||
1077 | call print_command_to_main |
||
1078 | |||
1079 | mov [command],dword 'PONG' |
||
1080 | |||
1081 | call print_command_to_main |
||
1082 | |||
1083 | mov eax,4 |
||
1084 | mov ebx,100*65536+3 |
||
1085 | mov ecx,0xffffff |
||
1086 | mov edx,command |
||
1087 | mov esi,[cmd] |
||
1088 | mov [command+esi-1],word '**' |
||
485 | heavyiron | 1089 | ; mcall |
31 | halyavin | 1090 | |
1091 | mov eax,53 |
||
1092 | mov ebx,7 |
||
1093 | mov ecx,[socket] |
||
1094 | mov edx,[cmd] |
||
1095 | sub edx,2 |
||
1096 | and edx,255 |
||
1097 | mov esi,command |
||
485 | heavyiron | 1098 | mcall |
31 | halyavin | 1099 | |
1100 | mov eax,53 |
||
1101 | mov ebx,7 |
||
1102 | mov ecx,[socket] |
||
1103 | mov edx,2 |
||
1104 | mov esi,linef |
||
485 | heavyiron | 1105 | mcall |
31 | halyavin | 1106 | |
1107 | popa |
||
1108 | ret |
||
1109 | |||
1110 | linef db 13,10 |
||
1111 | |||
1112 | no_ping_responce: |
||
1113 | |||
1114 | mov eax,[rxs] |
||
1115 | imul eax,11 |
||
1116 | mov [pos],eax |
||
1117 | |||
1118 | mov [command],byte '<' |
||
1119 | |||
1120 | mov eax,command |
||
1121 | mov ecx,100 |
||
1122 | new_blank: |
||
1123 | cmp [eax],byte ' ' |
||
195 | heavyiron | 1124 | je bl_found |
31 | halyavin | 1125 | inc eax |
1126 | loop new_blank |
||
1127 | mov eax,50 |
||
1128 | bl_found: |
||
1129 | |||
1130 | inc eax |
||
1131 | mov [command_position],eax |
||
1132 | |||
1133 | mov esi,eax |
||
1134 | mov edi,irc_command |
||
1135 | mov ecx,8 |
||
1136 | cld |
||
1137 | rep movsb |
||
1138 | |||
1139 | |||
1140 | cmp [irc_command],'PRIV' ; message to channel |
||
1141 | jne no_privmsg |
||
1142 | |||
1143 | ; compare nick |
||
1144 | |||
1145 | mov eax,[command_position] |
||
1146 | add eax,8 |
||
1147 | call compare_to_nick |
||
1148 | cmp [cresult],0 |
||
1149 | jne no_query_msg |
||
1150 | mov eax,command+1 |
||
1151 | no_query_msg: |
||
1152 | call set_channel |
||
1153 | |||
1154 | mov ecx,100 ; [cmd] |
||
1155 | mov eax,command+10 |
||
1156 | acl3: |
||
1157 | cmp [eax],byte ':' |
||
195 | heavyiron | 1158 | je acl4 |
31 | halyavin | 1159 | inc eax |
1160 | loop acl3 |
||
1161 | mov eax,10 |
||
1162 | acl4: |
||
1163 | inc eax |
||
1164 | |||
1165 | cmp [eax+1],dword 'ACTI' |
||
1166 | jne no_action |
||
1167 | push eax |
||
1168 | mov eax,action_header_short |
||
1169 | mov dl,0 |
||
1170 | call print_text |
||
1171 | mov eax,command+1 |
||
1172 | mov dl,'!' |
||
1173 | call print_text |
||
1174 | mov bl,' ' |
||
1175 | call print_character |
||
1176 | pop eax |
||
1177 | add eax,8 |
||
1178 | mov dl,0 |
||
1179 | call print_text |
||
1180 | popa |
||
1181 | ret |
||
1182 | |||
1183 | no_action: |
||
1184 | |||
1185 | push eax |
||
1186 | mov bl,10 |
||
1187 | call print_character |
||
1188 | mov eax,command |
||
1189 | mov dl,'!' |
||
1190 | call print_text |
||
1191 | mov bl,'>' |
||
1192 | call print_character |
||
1193 | mov bl,' ' |
||
1194 | call print_character |
||
1195 | pop eax |
||
1196 | |||
1197 | mov dl,0 |
||
1198 | call print_text |
||
1199 | |||
1200 | popa |
||
1201 | ret |
||
1202 | |||
1203 | no_privmsg: |
||
1204 | |||
1205 | |||
195 | heavyiron | 1206 | cmp [irc_command],'PART' ; channel leave |
31 | halyavin | 1207 | jne no_part |
1208 | |||
1209 | ; compare nick |
||
1210 | |||
1211 | mov eax,command+1 |
||
1212 | call compare_to_nick |
||
1213 | cmp [cresult],0 |
||
1214 | jne no_close_window |
||
1215 | |||
1216 | mov eax,[command_position] |
||
1217 | add eax,5 |
||
1218 | call set_channel |
||
1219 | |||
1220 | mov eax,[text_start] |
||
1221 | mov [eax+120*60+4],byte 1 |
||
1222 | |||
1223 | popa |
||
1224 | ret |
||
1225 | |||
1226 | no_close_window: |
||
1227 | |||
1228 | mov eax,[command_position] |
||
1229 | add eax,5 |
||
1230 | call set_channel |
||
1231 | |||
1232 | mov eax,action_header_red |
||
1233 | mov dl,0 |
||
1234 | call print_text |
||
1235 | mov eax,command+1 |
||
1236 | mov dl,'!' |
||
1237 | mov cl,' ' |
||
1238 | call print_text |
||
1239 | mov eax,has_left_channel |
||
1240 | mov dl,0 |
||
1241 | call print_text |
||
1242 | mov eax,[command_position] |
||
1243 | add eax,5 |
||
1244 | mov dl,' ' |
||
1245 | call print_text |
||
1246 | |||
1247 | popa |
||
1248 | ret |
||
1249 | |||
1250 | no_part: |
||
1251 | |||
1252 | |||
195 | heavyiron | 1253 | cmp [irc_command],'JOIN' ; channel join |
31 | halyavin | 1254 | jne no_join |
1255 | |||
1256 | ; compare nick |
||
1257 | |||
1258 | mov eax,command+1 |
||
1259 | call compare_to_nick |
||
1260 | cmp [cresult],0 |
||
1261 | jne no_new_window |
||
1262 | |||
1263 | mov edi,I_END+120*80 |
||
1264 | mov eax,1 ; create channel window - search for empty slot |
||
1265 | newse: |
||
1266 | mov ebx,eax |
||
1267 | shl ebx,5 |
||
1268 | cmp dword [channel_list+ebx],dword ' ' |
||
195 | heavyiron | 1269 | je free_found |
31 | halyavin | 1270 | add edi,120*80 |
1271 | inc eax |
||
1272 | cmp eax,[max_windows] |
||
195 | heavyiron | 1273 | jb newse |
31 | halyavin | 1274 | |
1275 | free_found: |
||
1276 | |||
1277 | mov edx,[command_position] |
||
1278 | add edx,6 |
||
1279 | |||
1280 | push eax |
||
1281 | push edx |
||
1282 | mov ecx,0 |
||
1283 | finde: |
||
1284 | inc ecx |
||
1285 | inc edx |
||
1286 | movzx eax,byte [edx] |
||
1287 | cmp eax,'#' |
||
1288 | jge finde |
||
1289 | mov [channel_list+ebx+31],cl |
||
1290 | pop edx |
||
1291 | pop eax |
||
1292 | |||
1293 | call create_channel_name |
||
1294 | |||
1295 | push edi |
||
1296 | push eax |
||
1297 | mov [edi+120*60+8],byte 0 ; channel window |
||
1298 | mov eax,32 |
||
1299 | mov ecx,120*60 |
||
1300 | cld |
||
1301 | rep stosb |
||
1302 | pop eax |
||
1303 | pop edi |
||
1304 | |||
1305 | ; eax has the free position |
||
1306 | mov [thread_screen],edi |
||
1307 | call create_channel_window |
||
1308 | |||
1309 | no_new_window: |
||
1310 | |||
1311 | mov eax,[command_position] |
||
1312 | add eax,6 |
||
1313 | call set_channel |
||
1314 | |||
1315 | mov eax,action_header_blue |
||
1316 | mov dl,0 |
||
1317 | call print_text |
||
1318 | mov eax,command+1 |
||
1319 | mov dl,'!' |
||
1320 | mov cl,' ' |
||
1321 | call print_text |
||
1322 | |||
1323 | mov eax,joins_channel |
||
1324 | mov dl,0 |
||
1325 | call print_text |
||
1326 | |||
1327 | mov eax,[command_position] |
||
1328 | add eax,6 |
||
1329 | mov dl,0 |
||
1330 | call print_text |
||
1331 | |||
1332 | popa |
||
1333 | ret |
||
1334 | |||
1335 | no_join: |
||
1336 | |||
1337 | |||
195 | heavyiron | 1338 | cmp [irc_command],'NICK' ; nick change |
31 | halyavin | 1339 | jne no_nick_change |
1340 | |||
1341 | mov [text_start],I_END |
||
1342 | add [text_start],120*80 |
||
1343 | |||
1344 | new_all_channels3: |
||
1345 | |||
1346 | mov eax,action_header_short |
||
1347 | mov dl,0 |
||
1348 | call print_text |
||
1349 | mov eax,command+1 |
||
1350 | mov dl,'!' |
||
1351 | call print_text |
||
1352 | mov eax,is_now_known_as |
||
1353 | mov dl,0 |
||
1354 | call print_text |
||
1355 | mov eax,[command_position] |
||
1356 | add eax,6 |
||
1357 | mov dl,0 |
||
1358 | call print_text |
||
1359 | |||
1360 | add [text_start],120*80 |
||
1361 | cmp [text_start],I_END+120*80*20 |
||
195 | heavyiron | 1362 | jb new_all_channels3 |
31 | halyavin | 1363 | |
1364 | popa |
||
1365 | ret |
||
1366 | |||
1367 | no_nick_change: |
||
1368 | |||
1369 | |||
195 | heavyiron | 1370 | cmp [irc_command],'KICK' ; kick |
31 | halyavin | 1371 | jne no_kick |
1372 | |||
1373 | mov [text_start],I_END |
||
1374 | add [text_start],120*80 |
||
1375 | |||
1376 | mov eax,[command_position] |
||
1377 | add eax,5 |
||
1378 | call set_channel |
||
1379 | |||
1380 | ; new_all_channels4: |
||
1381 | |||
1382 | mov eax,action_header_short |
||
1383 | mov dl,0 |
||
1384 | call print_text |
||
1385 | mov eax,command+1 |
||
1386 | mov dl,'!' |
||
1387 | call print_text |
||
1388 | mov eax,kicked |
||
1389 | mov dl,0 |
||
1390 | call print_text |
||
1391 | mov eax,[command_position] |
||
1392 | add eax,5 |
||
1393 | mov dl,0 |
||
1394 | call print_text |
||
1395 | |||
1396 | ; add [text_start],120*80 |
||
1397 | ; cmp [text_start],I_END+120*80*20 |
||
1398 | ; jb new_all_channels4 |
||
1399 | |||
1400 | popa |
||
1401 | ret |
||
1402 | |||
1403 | no_kick: |
||
1404 | |||
1405 | |||
1406 | |||
1407 | |||
195 | heavyiron | 1408 | cmp [irc_command],'QUIT' ; irc quit |
31 | halyavin | 1409 | jne no_quit |
1410 | |||
1411 | mov [text_start],I_END |
||
1412 | add [text_start],120*80 |
||
1413 | |||
1414 | new_all_channels2: |
||
1415 | |||
1416 | mov eax,action_header_red |
||
1417 | mov dl,0 |
||
1418 | call print_text |
||
1419 | mov eax,command+1 |
||
1420 | mov dl,'!' |
||
1421 | call print_text |
||
1422 | mov eax,has_quit_irc |
||
1423 | mov dl,0 |
||
1424 | call print_text |
||
1425 | |||
1426 | add [text_start],120*80 |
||
1427 | cmp [text_start],I_END+120*80*20 |
||
195 | heavyiron | 1428 | jb new_all_channels2 |
31 | halyavin | 1429 | |
1430 | popa |
||
1431 | ret |
||
1432 | |||
1433 | no_quit: |
||
1434 | |||
1435 | |||
1436 | cmp [irc_command],dword 'MODE' ; channel mode change |
||
1437 | jne no_mode |
||
1438 | |||
1439 | mov [text_start],I_END |
||
1440 | add [text_start],120*80 |
||
1441 | |||
1442 | mov eax,[command_position] |
||
1443 | add eax,5 |
||
1444 | call set_channel |
||
1445 | |||
1446 | new_all_channels: |
||
1447 | |||
1448 | mov eax,action_header_short |
||
1449 | mov dl,0 |
||
1450 | call print_text |
||
1451 | |||
1452 | call print_nick |
||
1453 | |||
1454 | mov eax,sets_mode |
||
1455 | mov dl,0 |
||
1456 | call print_text |
||
1457 | |||
1458 | mov eax,[command_position] |
||
1459 | add eax,5 |
||
1460 | mov dl,0 |
||
1461 | call print_text |
||
1462 | |||
1463 | ; add [text_start],120*80 |
||
1464 | ; cmp [text_start],I_END+120*80*20 |
||
1465 | ; jb new_all_channels |
||
1466 | |||
1467 | popa |
||
1468 | ret |
||
1469 | |||
1470 | no_mode: |
||
1471 | |||
1472 | |||
1473 | cmp [irc_command],dword '353 ' ; channel user names |
||
1474 | jne no_user_list |
||
1475 | |||
1476 | mov eax,[command_position] |
||
1477 | finde2: |
||
1478 | inc eax |
||
1479 | cmp [eax],byte '#' |
||
1480 | jne finde2 |
||
1481 | call set_channel |
||
1482 | |||
1483 | finde3: |
||
1484 | inc eax |
||
1485 | cmp [eax],byte ':' |
||
1486 | jne finde3 |
||
1487 | |||
1488 | pusha |
||
1489 | cmp [user_list_pos],0 |
||
1490 | jne no_clear_user_list |
||
1491 | mov edi,[text_start] |
||
1492 | add edi,120*70 |
||
1493 | mov [edi-8],dword 0 |
||
1494 | mov [edi-4],dword 0 |
||
1495 | mov eax,32 |
||
1496 | mov ecx,1200 |
||
1497 | cld |
||
1498 | rep stosb |
||
1499 | no_clear_user_list: |
||
1500 | popa |
||
1501 | |||
1502 | push eax |
||
1503 | |||
1504 | mov esi,eax |
||
1505 | inc esi |
||
1506 | mov edi,[text_start] |
||
1507 | add edi,120*70 |
||
1508 | add edi,[user_list_pos] |
||
1509 | mov edx,edi |
||
1510 | mov ecx,command |
||
1511 | add ecx,[cmd] |
||
1512 | sub ecx,[esp] |
||
1513 | sub ecx,3 |
||
1514 | and ecx,0xfff |
||
1515 | cld |
||
1516 | rep movsb |
||
1517 | |||
1518 | pop eax |
||
1519 | mov ebx,command |
||
1520 | add ebx,[cmd] |
||
1521 | sub ebx,eax |
||
1522 | sub ebx,2 |
||
1523 | mov [edx+ebx-1],dword ' ' |
||
1524 | |||
1525 | add [user_list_pos],ebx |
||
1526 | |||
1527 | mov eax,[user_list_pos] |
||
1528 | mov ebx,[text_start] |
||
1529 | add ebx,120*70 |
||
1530 | mov [ebx-4],eax |
||
1531 | |||
1532 | popa |
||
1533 | ret |
||
1534 | |||
1535 | user_list_pos dd 0x0 |
||
1536 | |||
1537 | no_user_list: |
||
1538 | |||
1539 | |||
1540 | cmp [irc_command],dword '366 ' ; channel user names end |
||
1541 | jne no_user_list_end |
||
1542 | |||
1543 | mov [user_list_pos],0 |
||
1544 | |||
1545 | popa |
||
1546 | ret |
||
1547 | |||
1548 | no_user_list_end: |
||
1549 | |||
1550 | mov [command],byte '-' |
||
1551 | call print_command_to_main |
||
1552 | |||
1553 | popa |
||
1554 | |||
1555 | ret |
||
1556 | |||
1557 | |||
1558 | cresult db 0 |
||
1559 | |||
1560 | compare_to_nick: |
||
1561 | |||
1562 | ; input : eax = start of compare |
||
1563 | ; output : [cresult] = 0 if match, [cresult]=1 if no match |
||
1564 | |||
1565 | |||
1566 | pusha |
||
1567 | |||
1568 | mov esi,eax |
||
1569 | mov edi,0 |
||
1570 | |||
1571 | new_nick_compare: |
||
1572 | |||
1573 | mov bl,byte [esi] |
||
1574 | mov cl,byte [user_nick+4+edi] |
||
1575 | |||
1576 | cmp bl,cl |
||
1577 | jne nonickm |
||
1578 | |||
1579 | add esi,1 |
||
1580 | add edi,1 |
||
1581 | |||
1582 | cmp edi,[user_nick] |
||
195 | heavyiron | 1583 | jb new_nick_compare |
31 | halyavin | 1584 | |
1585 | movzx eax,byte [esi] |
||
1586 | cmp eax,40 |
||
1587 | jge nonickm |
||
1588 | |||
1589 | popa |
||
1590 | mov [cresult],0 |
||
1591 | ret |
||
1592 | |||
1593 | nonickm: |
||
1594 | |||
1595 | popa |
||
1596 | mov [cresult],1 |
||
1597 | ret |
||
1598 | |||
1599 | |||
1600 | |||
1601 | |||
1602 | |||
1603 | print_command_to_main: |
||
1604 | |||
1605 | pusha |
||
1606 | |||
1607 | mov [text_start],I_END |
||
1608 | mov ecx,[rxs] |
||
1609 | imul ecx,11 |
||
1610 | mov [pos],ecx |
||
1611 | |||
1612 | mov bl,13 |
||
1613 | call print_character |
||
1614 | mov bl,10 |
||
1615 | call print_character |
||
1616 | |||
1617 | mov ecx,[cmd] |
||
1618 | sub ecx,2 |
||
1619 | mov esi,command |
||
1620 | newcmdc2: |
||
1621 | mov bl,[esi] |
||
1622 | call print_character |
||
1623 | inc esi |
||
1624 | loop newcmdc2 |
||
1625 | |||
1626 | mov edx,I_END |
||
1627 | call draw_channel_text |
||
1628 | |||
1629 | popa |
||
1630 | |||
1631 | ret |
||
1632 | |||
1633 | |||
1634 | |||
1635 | |||
1636 | print_text: |
||
1637 | |||
1638 | pusha |
||
1639 | |||
1640 | mov ecx,command-2 |
||
1641 | add ecx,[cmd] |
||
1642 | |||
1643 | ptr2: |
||
1644 | mov bl,[eax] |
||
1645 | cmp bl,dl |
||
195 | heavyiron | 1646 | je ptr_ret |
31 | halyavin | 1647 | cmp bl,0 |
195 | heavyiron | 1648 | je ptr_ret |
31 | halyavin | 1649 | call print_character |
1650 | inc eax |
||
1651 | cmp eax,ecx |
||
1652 | jbe ptr2 |
||
1653 | |||
1654 | ptr_ret: |
||
1655 | |||
1656 | mov eax,[text_start] |
||
1657 | mov [eax+120*60],byte 1 |
||
1658 | |||
1659 | popa |
||
1660 | ret |
||
1661 | |||
1662 | |||
195 | heavyiron | 1663 | cp1251_table: |
1664 | db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; 8 |
||
1665 | db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; 9 |
||
1666 | db '?','?','?','?','?','?','?','?' , $F0,'?','?','?','?','?','?','?' ; A |
||
1667 | db '?','?','?','?','?','?','?','?' , $F1,'?','?','?','?','?','?','?' ; B |
||
1668 | db $80,$81,$82,$83,$84,$85,$86,$87 , $88,$89,$8A,$8B,$8C,$8D,$8E,$8F ; C |
||
1669 | db $90,$91,$92,$93,$94,$95,$96,$97 , $98,$99,$9A,$9B,$9C,$9D,$9E,$9F ; D |
||
1670 | db $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7 , $A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF ; E |
||
1671 | db $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF ; F |
||
485 | heavyiron | 1672 | ; 0 1 2 3 4 5 6 7 8 9 A B C D E F |
31 | halyavin | 1673 | |
195 | heavyiron | 1674 | cp866_table: |
1675 | db $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7 , $C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF ; 8 |
||
1676 | db $D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7 , $D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF ; 9 |
||
1677 | db $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF ; A |
||
1678 | db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; B |
||
1679 | db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; C |
||
1680 | db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; D |
||
1681 | db $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7 , $F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF ; E |
||
1682 | db $A8,$B8,'?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; F |
||
485 | heavyiron | 1683 | ; 0 1 2 3 4 5 6 7 8 9 A B C D E F |
195 | heavyiron | 1684 | |
31 | halyavin | 1685 | print_character: |
1686 | |||
1687 | pusha |
||
1688 | |||
195 | heavyiron | 1689 | cmp bl,13 ; line beginning |
31 | halyavin | 1690 | jne nobol |
1691 | mov ecx,[pos] |
||
1692 | add ecx,1 |
||
1693 | boll1: |
||
1694 | sub ecx,1 |
||
1695 | mov eax,ecx |
||
1696 | xor edx,edx |
||
1697 | mov ebx,[rxs] |
||
1698 | div ebx |
||
1699 | cmp edx,0 |
||
1700 | jne boll1 |
||
1701 | mov [pos],ecx |
||
1702 | jmp newdata |
||
1703 | nobol: |
||
1704 | |||
195 | heavyiron | 1705 | cmp bl,10 ; line down |
31 | halyavin | 1706 | jne nolf |
1707 | addx1: |
||
1708 | add [pos],dword 1 |
||
1709 | mov eax,[pos] |
||
1710 | xor edx,edx |
||
1711 | mov ecx,[rxs] |
||
1712 | div ecx |
||
1713 | cmp edx,0 |
||
1714 | jnz addx1 |
||
1715 | mov eax,[pos] |
||
1716 | jmp cm1 |
||
1717 | nolf: |
||
1718 | no_lf_ret: |
||
1719 | |||
1720 | |||
195 | heavyiron | 1721 | cmp bl,15 ; character |
31 | halyavin | 1722 | jbe newdata |
1723 | |||
1724 | mov eax,[irc_data] |
||
1725 | shl eax,8 |
||
1726 | mov al,bl |
||
1727 | mov [irc_data],eax |
||
1728 | |||
1729 | mov eax,[pos] |
||
1730 | call draw_data |
||
1731 | |||
1732 | mov eax,[pos] |
||
1733 | add eax,1 |
||
1734 | cm1: |
||
1735 | mov ebx,[scroll+4] |
||
1736 | imul ebx,[rxs] |
||
1737 | cmp eax,ebx |
||
195 | heavyiron | 1738 | jb noeaxz |
31 | halyavin | 1739 | |
1740 | mov esi,[text_start] |
||
1741 | add esi,[rxs] |
||
1742 | |||
1743 | mov edi,[text_start] |
||
1744 | mov ecx,ebx |
||
1745 | cld |
||
1746 | rep movsb |
||
1747 | |||
1748 | mov esi,[text_start] |
||
1749 | mov ecx,[rxs] |
||
1750 | imul ecx,61 |
||
1751 | add esi,ecx |
||
1752 | |||
1753 | mov edi,[text_start] |
||
1754 | mov ecx,[rxs] |
||
1755 | imul ecx,60 |
||
1756 | add edi,ecx |
||
1757 | mov ecx,ebx |
||
1758 | cld |
||
1759 | rep movsb |
||
1760 | |||
1761 | mov eax,ebx |
||
1762 | sub eax,[rxs] |
||
1763 | noeaxz: |
||
1764 | mov [pos],eax |
||
1765 | |||
1766 | newdata: |
||
1767 | |||
1768 | mov eax,[text_start] |
||
1769 | mov [eax+120*60],byte 1 |
||
1770 | |||
1771 | popa |
||
1772 | ret |
||
1773 | |||
1774 | |||
1775 | |||
1776 | draw_data: |
||
1777 | |||
1778 | pusha |
||
1779 | |||
1780 | and ebx,0xff |
||
1781 | |||
1782 | cmp bl,0xe4 ; finnish a |
||
1783 | jne noe4 |
||
1784 | mov bl,0xc1 |
||
1785 | noe4: |
||
1786 | cmp bl,0xc4 ; ? |
||
1787 | jne noc4 |
||
1788 | mov bl,0xc9 |
||
1789 | noc4: |
||
1790 | |||
1791 | cmp ebx,229 ; swedish a |
||
1792 | jne no_swedish_a |
||
1793 | mov bl,192 |
||
1794 | no_swedish_a: |
||
1795 | |||
1796 | add eax,[text_start] |
||
1797 | mov [eax],bl |
||
1798 | |||
1799 | popa |
||
1800 | ret |
||
1801 | |||
1802 | |||
1803 | read_incoming_byte: |
||
1804 | |||
1805 | mov eax, 53 |
||
1806 | mov ebx, 2 |
||
1807 | mov ecx, [socket] |
||
485 | heavyiron | 1808 | mcall |
31 | halyavin | 1809 | |
1810 | mov ecx,-1 |
||
1811 | |||
1812 | cmp eax,0 |
||
195 | heavyiron | 1813 | je no_more_data |
31 | halyavin | 1814 | |
1815 | mov eax, 53 |
||
1816 | mov ebx, 3 |
||
1817 | mov ecx, [socket] |
||
485 | heavyiron | 1818 | mcall |
31 | halyavin | 1819 | |
195 | heavyiron | 1820 | cmp bl,0x80 |
1821 | jb @f |
||
1822 | and ebx,0x7F |
||
1823 | mov bl,[cp1251_table+ebx] |
||
1824 | @@: |
||
1825 | |||
31 | halyavin | 1826 | mov ecx,0 |
1827 | |||
1828 | no_more_data: |
||
1829 | |||
1830 | ret |
||
1831 | |||
1832 | |||
1833 | |||
1834 | draw_window: |
||
1835 | |||
1836 | pusha |
||
1837 | |||
1838 | mov eax,12 |
||
1839 | mov ebx,1 |
||
485 | heavyiron | 1840 | mcall |
31 | halyavin | 1841 | |
1842 | mov [old_status],300 |
||
1843 | |||
485 | heavyiron | 1844 | xor eax,eax ; draw window |
31 | halyavin | 1845 | mov ebx,5*65536+499 |
1846 | mov ecx,5*65536+345 |
||
1847 | mov edx,[wcolor] |
||
551 | spraid | 1848 | add edx,0x14ffffff |
485 | heavyiron | 1849 | mov edi,title |
1850 | mcall |
||
31 | halyavin | 1851 | |
195 | heavyiron | 1852 | mov eax,8 ; button: open socket |
31 | halyavin | 1853 | mov ebx,43*65536+22 |
1854 | mov ecx,229*65536+10 |
||
1855 | mov edx,22 |
||
1856 | mov esi,[main_button] |
||
485 | heavyiron | 1857 | mcall |
31 | halyavin | 1858 | |
485 | heavyiron | 1859 | ;mov eax,8 ; button: send userinfo |
31 | halyavin | 1860 | mov ebx,180*65536+22 |
1861 | mov ecx,229*65536+10 |
||
1862 | mov edx,23 |
||
485 | heavyiron | 1863 | mcall |
31 | halyavin | 1864 | |
485 | heavyiron | 1865 | ;mov eax,8 ; button: close socket |
31 | halyavin | 1866 | mov ebx,317*65536+22 |
1867 | mov ecx,229*65536+10 |
||
1868 | mov edx,24 |
||
485 | heavyiron | 1869 | mcall |
31 | halyavin | 1870 | |
195 | heavyiron | 1871 | mov eax,38 ; line |
31 | halyavin | 1872 | mov ebx,5*65536+494 |
1873 | mov ecx,148*65536+148 |
||
1874 | mov edx,[main_line] |
||
485 | heavyiron | 1875 | mcall |
31 | halyavin | 1876 | add ecx,1*65536+1 |
1877 | |||
195 | heavyiron | 1878 | mov eax,38 ; line |
31 | halyavin | 1879 | mov ebx,5*65536+494 |
1880 | mov ecx,166*65536+166 |
||
485 | heavyiron | 1881 | mcall |
31 | halyavin | 1882 | add ecx,1*65536+1 |
1883 | |||
195 | heavyiron | 1884 | mov eax,38 ; line |
31 | halyavin | 1885 | mov ebx,410*65536+410 |
1886 | mov ecx,22*65536+148 |
||
485 | heavyiron | 1887 | mcall |
31 | halyavin | 1888 | add ebx,1*65536+1 |
1889 | |||
195 | heavyiron | 1890 | mov ebx,25*65536+183 ; info text |
31 | halyavin | 1891 | mov ecx,0x000000 |
1892 | mov edx,text |
||
1893 | mov esi,70 |
||
1894 | newline: |
||
1895 | mov eax,4 |
||
485 | heavyiron | 1896 | mcall |
31 | halyavin | 1897 | add ebx,12 |
1898 | add edx,70 |
||
1899 | cmp [edx],byte 'x' |
||
1900 | jne newline |
||
1901 | |||
195 | heavyiron | 1902 | mov edx,I_END ; text from server |
31 | halyavin | 1903 | call draw_channel_text |
1904 | |||
1905 | mov eax,12 |
||
1906 | mov ebx,2 |
||
485 | heavyiron | 1907 | mcall |
31 | halyavin | 1908 | |
1909 | popa |
||
1910 | |||
1911 | ret |
||
1912 | |||
1913 | main_line dd 0x000000 |
||
1914 | main_button dd 0x6565cc |
||
1915 | |||
1916 | |||
1917 | text: |
||
1918 | |||
195 | heavyiron | 1919 | db ' Real name : KolibriOS User - change with eg /areal Jill User ' |
485 | heavyiron | 1920 | db ' Nick : KolibriOS User - change with eg /anick Jill ' |
1921 | db ' Server : kolibrios.org - change with eg /aserv irc.by ' |
||
31 | halyavin | 1922 | db ' ' |
1923 | db ' 1) Open socket 2) Send userinfo Close socket ' |
||
1924 | db ' ' |
||
1925 | db ' Commands after established connection: ' |
||
1926 | db ' ' |
||
195 | heavyiron | 1927 | db ' /join #ChannelName - eg /join #general ' |
1928 | db ' /part #ChannelName - eg /part #windows ' |
||
31 | halyavin | 1929 | db ' /query Nickname - eg /query Mary ' |
1930 | db ' /quit - Quit server and Close socket ' |
||
1931 | |||
195 | heavyiron | 1932 | db 'x' ; <- END MARKER, DONT DELETE |
31 | halyavin | 1933 | |
1934 | |||
1935 | |||
1936 | |||
1937 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1938 | ; |
||
1939 | ; CHANNEL THREADS |
||
1940 | ; |
||
1941 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
1942 | |||
1943 | |||
1944 | |||
1945 | channel_thread: |
||
1946 | |||
1947 | mov ebp,[thread_nro] |
||
1948 | mov eax,ebp |
||
1949 | shl eax,14 |
||
1950 | add eax,0x80000 |
||
1951 | mov esp,eax |
||
1952 | |||
195 | heavyiron | 1953 | mov edi,ebp ; clear thread memory |
31 | halyavin | 1954 | imul edi,120*80 |
1955 | add edi,I_END |
||
1956 | mov ecx,120*80 |
||
1957 | mov eax,32 |
||
1958 | cld |
||
1959 | ; rep stosb |
||
1960 | |||
1961 | mov edx,[thread_screen] |
||
1962 | |||
1963 | call thread_draw_window |
||
1964 | |||
1965 | w_t: |
||
1966 | |||
1967 | mov esi,ebp |
||
1968 | imul esi,120*80 |
||
1969 | add esi,I_END |
||
1970 | cmp [esi+120*60+4],byte 1 |
||
1971 | jne no_channel_leave |
||
1972 | mov [esi+120*60+4],byte 0 |
||
1973 | mov edi,ebp |
||
1974 | shl edi,5 |
||
1975 | mov dword [channel_list+edi],dword ' ' |
||
1976 | mov byte [channel_list+edi+31],byte 1 |
||
1977 | mov eax,-1 |
||
485 | heavyiron | 1978 | mcall |
31 | halyavin | 1979 | no_channel_leave: |
1980 | |||
1981 | call check_mouse |
||
1982 | |||
1983 | mov eax,23 |
||
1984 | mov ebx,1 |
||
485 | heavyiron | 1985 | mcall |
31 | halyavin | 1986 | |
1987 | cmp eax,1 |
||
1988 | jne no_draw_window |
||
1989 | call thread_draw_window |
||
1990 | call draw_channel_text |
||
1991 | call print_user_list |
||
1992 | no_draw_window: |
||
1993 | |||
1994 | cmp eax,2 |
||
195 | heavyiron | 1995 | je thread_key |
31 | halyavin | 1996 | |
1997 | cmp eax,3 |
||
1998 | jne no_end |
||
1999 | mov eax,17 |
||
485 | heavyiron | 2000 | mcall |
31 | halyavin | 2001 | mov eax,ebp |
2002 | imul eax,120*80 |
||
2003 | add eax,I_END |
||
2004 | cmp [eax+120*60+8],byte 0 ; channel window |
||
195 | heavyiron | 2005 | je not_close |
31 | halyavin | 2006 | mov eax,ebp |
2007 | shl eax,5 |
||
2008 | add eax,channel_list |
||
2009 | mov [eax],dword ' ' |
||
2010 | mov [eax+31],byte 1 |
||
2011 | mov eax,-1 |
||
485 | heavyiron | 2012 | mcall |
31 | halyavin | 2013 | not_close: |
2014 | mov [text_start],eax |
||
2015 | mov eax,nocl |
||
2016 | newcc: |
||
2017 | mov bl,[eax] |
||
2018 | call print_character |
||
2019 | inc eax |
||
2020 | cmp [eax],byte 0 |
||
2021 | jne newcc |
||
2022 | call draw_channel_text |
||
2023 | jmp w_t |
||
2024 | nocl: db 13,10,'To exit channel, use PART or QUIT command.',0 |
||
2025 | no_end: |
||
2026 | |||
2027 | cmp [edx+120*60],byte 1 |
||
2028 | jne no_update |
||
2029 | mov [edx+120*60],byte 0 |
||
2030 | call draw_channel_text |
||
2031 | no_update: |
||
2032 | |||
2033 | test [cursor_on_off],0x3f |
||
2034 | jnz nopri2 |
||
2035 | |||
2036 | call blink_cursor |
||
2037 | call print_user_list |
||
2038 | |||
2039 | nopri2: |
||
2040 | |||
2041 | jmp w_t |
||
2042 | |||
2043 | |||
2044 | |||
2045 | check_mouse: |
||
2046 | |||
2047 | pusha |
||
2048 | |||
2049 | mov eax,37 |
||
2050 | mov ebx,1 |
||
485 | heavyiron | 2051 | mcall |
31 | halyavin | 2052 | |
2053 | mov ebx,eax |
||
2054 | shr eax,16 |
||
2055 | and ebx,0xffff |
||
2056 | |||
2057 | cmp eax,420 |
||
195 | heavyiron | 2058 | jb no_mouse |
31 | halyavin | 2059 | cmp eax,494 |
195 | heavyiron | 2060 | jg no_mouse |
31 | halyavin | 2061 | |
2062 | cmp ebx,145 |
||
195 | heavyiron | 2063 | jg no_mouse |
31 | halyavin | 2064 | cmp ebx,23 |
195 | heavyiron | 2065 | jb no_mouse |
31 | halyavin | 2066 | |
2067 | |||
2068 | cmp ebx,100 |
||
195 | heavyiron | 2069 | jb no_plus |
31 | halyavin | 2070 | mov eax,ebp |
2071 | imul eax,120*80 |
||
2072 | add eax,120*70+I_END |
||
2073 | inc dword [eax-8] |
||
2074 | call print_user_list |
||
2075 | mov eax,5 |
||
2076 | mov ebx,8 |
||
485 | heavyiron | 2077 | mcall |
31 | halyavin | 2078 | jmp no_mouse |
2079 | no_plus: |
||
2080 | |||
2081 | cmp ebx,80 |
||
195 | heavyiron | 2082 | jg no_mouse |
31 | halyavin | 2083 | mov eax,ebp |
2084 | imul eax,120*80 |
||
2085 | add eax,120*70+I_END |
||
2086 | cmp dword [eax-8],dword 0 |
||
195 | heavyiron | 2087 | je no_mouse |
31 | halyavin | 2088 | dec dword [eax-8] |
2089 | call print_user_list |
||
2090 | mov eax,5 |
||
2091 | mov ebx,8 |
||
485 | heavyiron | 2092 | mcall |
31 | halyavin | 2093 | |
2094 | no_minus: |
||
2095 | |||
2096 | no_mouse: |
||
2097 | |||
2098 | popa |
||
2099 | |||
2100 | ret |
||
2101 | |||
2102 | |||
2103 | |||
2104 | |||
2105 | thread_key: |
||
2106 | |||
2107 | mov eax,2 |
||
485 | heavyiron | 2108 | mcall |
31 | halyavin | 2109 | |
2110 | shr eax,8 |
||
2111 | |||
2112 | cmp eax,8 |
||
2113 | jne no_bks |
||
2114 | cmp [xpos],0 |
||
195 | heavyiron | 2115 | je w_t |
31 | halyavin | 2116 | dec [xpos] |
2117 | call print_entry |
||
2118 | jmp w_t |
||
2119 | no_bks: |
||
2120 | |||
2121 | cmp eax,20 |
||
2122 | jbe no_character |
||
2123 | mov ebx,[xpos] |
||
2124 | mov [send_string+ebx],al |
||
2125 | inc [xpos] |
||
2126 | cmp [xpos],80 |
||
195 | heavyiron | 2127 | jb xpok |
31 | halyavin | 2128 | mov [xpos],79 |
2129 | xpok: |
||
2130 | call print_entry |
||
2131 | jmp w_t |
||
2132 | no_character: |
||
2133 | |||
2134 | cmp eax,13 |
||
2135 | jne no_send |
||
2136 | cmp [xpos],0 |
||
195 | heavyiron | 2137 | je no_send |
31 | halyavin | 2138 | mov dword [send_to_channel],ebp |
2139 | mov [send_to_server],1 |
||
2140 | wait_for_sending: |
||
2141 | mov eax,5 |
||
2142 | mov ebx,1 |
||
485 | heavyiron | 2143 | mcall |
31 | halyavin | 2144 | cmp [send_to_server],1 |
195 | heavyiron | 2145 | je wait_for_sending |
31 | halyavin | 2146 | call draw_channel_text |
2147 | call print_entry |
||
2148 | jmp w_t |
||
2149 | no_send: |
||
2150 | |||
2151 | jmp w_t |
||
2152 | |||
2153 | |||
2154 | |||
2155 | |||
2156 | |||
2157 | |||
2158 | draw_channel_text: |
||
2159 | |||
2160 | pusha |
||
2161 | |||
2162 | mov eax,4 |
||
2163 | mov ebx,10*65536+26 |
||
2164 | mov ecx,12 |
||
2165 | mov esi,[rxs] |
||
2166 | dct: |
||
2167 | pusha |
||
2168 | mov cx,bx |
||
2169 | shl ecx,16 |
||
2170 | mov cx,9 |
||
2171 | mov eax,13 |
||
2172 | mov ebx,10*65536 |
||
2173 | mov bx,word [rxs] |
||
2174 | imul bx,6 |
||
2175 | mov edx,0xffffff |
||
485 | heavyiron | 2176 | mcall |
31 | halyavin | 2177 | popa |
2178 | push ecx |
||
2179 | mov eax,4 |
||
2180 | mov ecx,0 |
||
2181 | cmp [edx],word '* ' |
||
2182 | jne no_red |
||
2183 | mov ecx,0x0000ff |
||
2184 | no_red: |
||
2185 | cmp [edx],word '**' |
||
2186 | jne no_light_blue |
||
2187 | cmp [edx+2],byte '*' |
||
2188 | jne no_light_blue |
||
2189 | mov ecx,0x0000ff |
||
2190 | no_light_blue: |
||
2191 | cmp [edx],byte '#' |
||
2192 | jne no_blue |
||
2193 | mov ecx,0x0000ff |
||
2194 | no_blue: |
||
485 | heavyiron | 2195 | mcall |
31 | halyavin | 2196 | add edx,[rxs] |
2197 | add ebx,10 |
||
2198 | pop ecx |
||
2199 | loop dct |
||
2200 | |||
2201 | popa |
||
2202 | ret |
||
2203 | |||
2204 | |||
2205 | |||
2206 | |||
2207 | |||
2208 | thread_draw_window: |
||
2209 | |||
2210 | pusha |
||
2211 | |||
2212 | mov eax,12 |
||
2213 | mov ebx,1 |
||
485 | heavyiron | 2214 | mcall |
31 | halyavin | 2215 | |
195 | heavyiron | 2216 | mov ebx,ebp ; draw window |
31 | halyavin | 2217 | shl ebx,16+4 |
2218 | mov eax,0 |
||
2219 | mov ecx,ebx |
||
2220 | mov bx,499 |
||
2221 | mov cx,170 |
||
2222 | |||
2223 | ; mov edx,ebp ; draw window |
||
2224 | ; imul edx,120*80 |
||
2225 | ; add edx,I_END+120*60+8 |
||
2226 | ; movzx edx,byte [edx] |
||
2227 | ; imul edx,88 |
||
2228 | ; sub bx,dx |
||
2229 | |||
2230 | mov edx,[wcolor] |
||
2231 | add edx,0x03ffffff |
||
2232 | mov esi,0x80555599 |
||
2233 | mov edi,0x00ffffff |
||
2234 | |||
485 | heavyiron | 2235 | mcall |
31 | halyavin | 2236 | |
195 | heavyiron | 2237 | mov eax,ebp ; label |
31 | halyavin | 2238 | add eax,48 |
2239 | mov [labelc+14],al |
||
2240 | mov eax,ebp |
||
2241 | shl eax,5 |
||
2242 | add eax,channel_list |
||
2243 | mov esi,eax |
||
2244 | mov edi,labelc+17 |
||
2245 | movzx ecx,byte [eax+31] |
||
2246 | cld |
||
2247 | rep movsb |
||
2248 | |||
195 | heavyiron | 2249 | mov esi,17 ; print label |
31 | halyavin | 2250 | movzx ebx,byte [eax+31] |
2251 | add esi,ebx |
||
2252 | mov eax,4 |
||
2253 | mov ebx,9*65536+8 |
||
2254 | mov ecx,0x00ffffff |
||
2255 | mov edx,labelc |
||
485 | heavyiron | 2256 | mcall |
31 | halyavin | 2257 | |
195 | heavyiron | 2258 | mov eax,38 ; line |
31 | halyavin | 2259 | mov ebx,5*65536+494 |
2260 | mov ecx,148*65536+148 |
||
2261 | mov edx,[channel_line_sun] |
||
485 | heavyiron | 2262 | mcall |
31 | halyavin | 2263 | add ecx,1*65536+1 |
2264 | mov edx,[channel_line_shadow] |
||
485 | heavyiron | 2265 | mcall |
31 | halyavin | 2266 | |
2267 | |||
485 | heavyiron | 2268 | ;mov eax,38 ; line |
31 | halyavin | 2269 | mov ebx,410*65536+410 |
2270 | mov ecx,22*65536+148 |
||
2271 | mov edx,[channel_line_sun] |
||
485 | heavyiron | 2272 | mcall |
31 | halyavin | 2273 | add ebx,1*65536+1 |
2274 | mov edx,[channel_line_shadow] |
||
485 | heavyiron | 2275 | mcall |
31 | halyavin | 2276 | |
2277 | mov eax,12 |
||
2278 | mov ebx,2 |
||
485 | heavyiron | 2279 | mcall |
31 | halyavin | 2280 | |
2281 | popa |
||
2282 | |||
2283 | ret |
||
2284 | |||
2285 | |||
2286 | ; DATA AREA |
||
2287 | |||
195 | heavyiron | 2288 | socket dd 0x0 |
31 | halyavin | 2289 | |
2290 | bgc dd 0x000000 |
||
2291 | dd 0x000000 |
||
2292 | dd 0x00ff00 |
||
2293 | dd 0x0000ff |
||
2294 | dd 0x005500 |
||
2295 | dd 0xff00ff |
||
2296 | dd 0x00ffff |
||
2297 | dd 0x770077 |
||
2298 | |||
2299 | tc dd 0xffffff |
||
2300 | dd 0xff00ff |
||
2301 | dd 0xffffff |
||
2302 | dd 0xffffff |
||
2303 | dd 0xffffff |
||
2304 | dd 0xffffff |
||
2305 | dd 0xffffff |
||
2306 | dd 0xffffff |
||
2307 | |||
2308 | channel_line_sun dd 0x9999ff |
||
2309 | channel_line_shadow dd 0x666699 |
||
2310 | |||
2311 | cursor_on_off dd 0x0 |
||
2312 | |||
2313 | max_windows dd 20 |
||
2314 | |||
2315 | thread_stack dd 0x9fff0 |
||
2316 | thread_nro dd 1 |
||
2317 | thread_screen dd I_END+120*80*1 |
||
2318 | |||
195 | heavyiron | 2319 | action_header_blue db 10,'*** ',0 |
2320 | action_header_red db 10,'*** ',0 |
||
31 | halyavin | 2321 | |
195 | heavyiron | 2322 | action_header_short db 10,'* ',0 |
31 | halyavin | 2323 | |
195 | heavyiron | 2324 | has_left_channel db ' has left ',0 |
2325 | joins_channel db ' has joined ',0 |
||
31 | halyavin | 2326 | is_now_known_as db ' is now known as ',0 |
195 | heavyiron | 2327 | has_quit_irc db ' has quit IRC',0 |
2328 | sets_mode db ' sets mode ',0 |
||
2329 | kicked db ' kicked from ',0 |
||
31 | halyavin | 2330 | |
195 | heavyiron | 2331 | index_list_1 dd 0x0000bb |
2332 | index_list_2 dd 0x0000ff |
||
31 | halyavin | 2333 | |
195 | heavyiron | 2334 | posx dd 0x0 |
2335 | incoming_pos dd 0x0 |
||
31 | halyavin | 2336 | incoming_string: times 128 db 0 |
2337 | |||
195 | heavyiron | 2338 | pos dd 0x0 |
31 | halyavin | 2339 | |
2340 | text_start dd I_END |
||
2341 | irc_data dd 0x0 |
||
195 | heavyiron | 2342 | print db 0x0 |
2343 | cmd dd 0x0 |
||
2344 | rxs dd 66 |
||
31 | halyavin | 2345 | |
195 | heavyiron | 2346 | res: db 0,0 |
31 | halyavin | 2347 | command: times 600 db 0x0 |
2348 | |||
195 | heavyiron | 2349 | nick dd 0,0,0 |
31 | halyavin | 2350 | irc_command dd 0,0 |
2351 | |||
2352 | command_position dd 0x0 |
||
195 | heavyiron | 2353 | counter dd 0 |
2354 | send_to_server db 0 |
||
31 | halyavin | 2355 | |
195 | heavyiron | 2356 | channel_list: times 32*20 db 32 |
31 | halyavin | 2357 | send_to_channel dd 0x0 |
2358 | |||
2359 | send_string_header: db 'privmsg #eax :' |
||
195 | heavyiron | 2360 | times 100 db 0x0 |
31 | halyavin | 2361 | |
195 | heavyiron | 2362 | send_string: times 100 db 0x0 |
2363 | xpos dd 0 |
||
31 | halyavin | 2364 | |
2365 | string0: db 'USER guest ser1 ser2 :' |
||
2366 | string0l: |
||
2367 | string1: db 'nick ' |
||
2368 | string1l: |
||
2369 | |||
195 | heavyiron | 2370 | attribute dd 0 |
2371 | scroll dd 1 |
||
2372 | dd 12 |
||
31 | halyavin | 2373 | |
195 | heavyiron | 2374 | numtext db ' ' |
31 | halyavin | 2375 | |
195 | heavyiron | 2376 | wcolor dd 0x000000 |
31 | halyavin | 2377 | |
195 | heavyiron | 2378 | labelc db 'AIRC - WINDOW X: #xxx ' |
485 | heavyiron | 2379 | title db 'IRC client ',version,0 |
31 | halyavin | 2380 | |
485 | heavyiron | 2381 | ;include_debug_strings ; ALWAYS present in data section |
2382 | |||
2383 | dnsMsg: rb 512 ; buffer used by DNS client |
||
2384 | |||
2385 | |||
31 | halyavin | 2386 | ;; |
2387 | ;; Channel data at I_END |
||
2388 | ;; |
||
2389 | ;; 120*80 * channel window (1+) |
||
2390 | ;; |
||
2391 | ;; At Size |
||
2392 | ;; |
||
2393 | ;; 00 , 120*60 window text 120 characters per row |
||
2394 | ;; 120*60 , 1 text is updated |
||
2395 | ;; 120*60+4 , 1 close yourself |
||
2396 | ;; 120*60+8 , 1 0 = channel window : 1 = private chat |
||
2397 | ;; 120*61 , 256 channel name |
||
2398 | ;; 120*61+254 , 254 channel entry text from user |
||
2399 | ;; 120*61+255 , 1 length of entry text |
||
2400 | ;; 120*69+248 , 4 display names from n:th name |
||
2401 | ;; 120*69+252 , 4 length of names string |
||
2402 | ;; 120*70 , 1200 names separated with space |
||
2403 | ;; |
||
2404 | I_END: ;;->' |