Subversion Repositories Kolibri OS

Rev

Rev 7090 | Rev 7889 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7090 Rev 7300
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2018. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;  IRC client for KolibriOS                                       ;;
6
;;  IRC client for KolibriOS                                       ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;   Written by hidnplayr@kolibrios.org,                           ;;
8
;;   Written by hidnplayr@kolibrios.org,                           ;;
Line 11... Line 11...
11
;;         GNU GENERAL PUBLIC LICENSE                              ;;
11
;;         GNU GENERAL PUBLIC LICENSE                              ;;
12
;;          Version 2, June 1991                                   ;;
12
;;          Version 2, June 1991                                   ;;
13
;;                                                                 ;;
13
;;                                                                 ;;
14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 15... Line 15...
15
 
15
 
Line 16... Line 16...
16
version equ '0.30'
16
version equ '0.31'
17
 
17
 
18
; connection status
18
; connection status
19
STATUS_DISCONNECTED     = 0
19
STATUS_DISCONNECTED     = 0
Line 60... Line 60...
60
MAX_USERS               = 4096
60
MAX_USERS               = 4096
61
TEXT_BUFFERSIZE         = 1024*1024
61
TEXT_BUFFERSIZE         = 1024*1024
Line 62... Line 62...
62
 
62
 
63
MAX_NICK_LEN            = 32
63
MAX_NICK_LEN            = 32
-
 
64
MAX_REAL_LEN            = 32    ; realname
64
MAX_REAL_LEN            = 32    ; realname
65
QUIT_MSG_LEN            = 250
Line 65... Line 66...
65
MAX_SERVER_NAME         = 256
66
MAX_SERVER_NAME         = 256
66
 
67
 
Line 67... Line 68...
67
MAX_CHANNEL_LEN         = 40
68
MAX_CHANNEL_LEN         = 40
Line -... Line 69...
-
 
69
MAX_CHANNELS            = 37
-
 
70
 
-
 
71
MAX_COMMAND_LEN         = 512
-
 
72
 
-
 
73
PACKETBUF_SIZE          = 1024
68
MAX_CHANNELS            = 37
74
PATH_SIZE               = 1024
Line 69... Line 75...
69
 
75
PARAM_SIZE              = 1024
Line 70... Line 76...
70
MAX_COMMAND_LEN         = 512
76
SERVERCOMMAND_SIZE      = 600
Line 152... Line 158...
152
        jnz     exit
158
        jnz     exit
Line 153... Line 159...
153
 
159
 
154
; find path to main settings file (ircc.ini)
160
; find path to main settings file (ircc.ini)
155
        mov     edi, path               ; Calculate the length of zero-terminated string
161
        mov     edi, path               ; Calculate the length of zero-terminated string
156
        xor     al, al
162
        xor     al, al
157
        mov     ecx, 1024
163
        mov     ecx, PATH_SIZE
158
        repne   scasb
164
        repne   scasb
159
        dec     edi
165
        dec     edi
160
        mov     eax, '.ini'
166
        mov     eax, '.ini'
161
        stosd
167
        stosd
Line 168... Line 174...
168
        xor     eax, eax
174
        xor     eax, eax
169
        rep     stosd
175
        rep     stosd
Line 170... Line 176...
170
 
176
 
171
; clear command area too
177
; clear command area too
172
        mov     edi, servercommand
178
        mov     edi, servercommand
173
        mov     ecx, 600/4
179
        mov     ecx, SERVERCOMMAND_SIZE/4
Line 174... Line 180...
174
        rep     stosd
180
        rep     stosd
175
 
181
 
176
; allocate window data block
182
; allocate window data block
177
        mov     ebx, windows
183
        mov     ebx, windows
178
        call    window_create_textbox
184
        call    window_create_textbox
179
        test    eax, eax
185
        test    eax, eax
Line 180... Line 186...
180
        jz      error
186
        jz      exit
181
        mov     [ebx + window.type], WINDOWTYPE_SERVER
187
        mov     [ebx + window.type], WINDOWTYPE_SERVER
Line 210... Line 216...
210
 
216
 
211
; Check if parameter contains an URL
217
; Check if parameter contains an URL
212
        cmp     byte[param], 0
218
        cmp     byte[param], 0
213
        je      @f
219
        je      @f
214
        mov     esi, param
220
        mov     esi, param
215
        mov     ecx, 1024
221
        mov     ecx, PARAM_SIZE
216
        call    cmd_usr_server.now
222
        call    cmd_usr_server.now
Line 217... Line 223...
217
  @@:
223
  @@:
218
 
224
 
Line 253... Line 259...
253
 
259
 
254
        mcall   17              ; get id
260
        mcall   17              ; get id
Line 255... Line 261...
255
        ror     eax, 8
261
        ror     eax, 8
256
 
262
 
Line 257... Line 263...
257
        cmp     ax, 1           ; close program
263
        cmp     ax, 1           ; close program
258
        je      exit
264
        je      quit
259
 
265
 
260
        cmp     ax, WINDOW_BTN_CLOSE
266
        cmp     ax, WINDOW_BTN_CLOSE
Line 316... Line 322...
316
        inc     esi
322
        inc     esi
317
        jmp     .open
323
        jmp     .open
Line 318... Line 324...
318
 
324
 
319
  @@:
325
  @@:
320
        sub     ax, WINDOW_BTN_START
326
        sub     ax, WINDOW_BTN_START
Line 321... Line 327...
321
        jb      exit
327
        jb      quit
322
 
328
 
Line 323... Line 329...
323
        cmp     ax, MAX_WINDOWS
329
        cmp     ax, MAX_WINDOWS
324
        ja      exit
330
        ja      quit
325
 
331
 
326
; Save users scrollbar position
332
; Save users scrollbar position
Line 333... Line 339...
333
        mul     dx
339
        mul     dx
334
        shl     edx, 16
340
        shl     edx, 16
335
        mov     dx, ax
341
        mov     dx, ax
336
        add     edx, windows
342
        add     edx, windows
337
        cmp     [edx + window.type], WINDOWTYPE_NONE
343
        cmp     [edx + window.type], WINDOWTYPE_NONE
338
        je      exit
344
        je      quit
339
        mov     [window_active], edx
345
        mov     [window_active], edx
Line 340... Line 346...
340
 
346
 
341
        push    [edx + window.text_line_print]
347
        push    [edx + window.text_line_print]
Line 345... Line 351...
345
        pop     [scroll1.position]
351
        pop     [scroll1.position]
Line 346... Line 352...
346
 
352
 
347
        call    draw_window
353
        call    draw_window
Line 348... Line 354...
348
        jmp     mainloop
354
        jmp     mainloop
349
 
-
 
350
exit:
355
 
351
 
356
quit:
352
        cmp     [socketnum], 0
357
        cmp     [socketnum], 0
353
        je      @f
358
        je      @f
354
        mov     esi, quit_msg
359
        mov     esi, quit_msg
Line 355... Line 360...
355
        call    quit_server
360
        call    quit_server
-
 
361
  @@:
-
 
362
 
-
 
363
exit:
-
 
364
 
-
 
365
; Close all open windows
-
 
366
        call    window_close_all
-
 
367
 
-
 
368
; Erase RAM areas which could contain the connection details
-
 
369
        xor     eax, eax
-
 
370
        mov     edi, irc_server_name
-
 
371
        mov     ecx, MAX_SERVER_NAME
-
 
372
        rep stosb
-
 
373
 
-
 
374
        mov     edi, user_nick
-
 
375
        mov     ecx, MAX_NICK_LEN
-
 
376
        rep stosb
-
 
377
 
-
 
378
        mov     edi, user_real_name
-
 
379
        mov     ecx, MAX_REAL_LEN
-
 
380
        rep stosb
-
 
381
 
Line 356... Line 382...
356
  @@:
382
        mov     edi, sockaddr1
Line 457... Line 483...
457
mode_header             db 3, '2* ', 0
483
mode_header             db 3, '2* ', 0
458
part_header             db 3, '5* ', 0
484
part_header             db 3, '5* ', 0
459
topic_header            db 3, '3* ', 0
485
topic_header            db 3, '3* ', 0
460
action_header           db 3, '6* ', 0
486
action_header           db 3, '6* ', 0
461
ctcp_header             db 3, '13-> [', 0
487
ctcp_header             db 3, '13-> [', 0
-
 
488
ctcp_header_recv        db 3, '13', 0
462
msg_header              db 3, '7-> *', 0
489
msg_header              db 3, '7-> *', 0
463
ctcp_version            db '] VERSION', 10, 0
490
ctcp_version            db '] VERSION', 10, 0
464
ctcp_ping               db '] PING', 10, 0
491
ctcp_ping               db '] PING', 10, 0
465
ctcp_time               db '] TIME', 10, 0
492
ctcp_time               db '] TIME', 10, 0
Line 503... Line 530...
503
                        db '/code         : change codepage (cp866, cp1251, or utf8)', 10
530
                        db '/code          : change codepage (cp866, cp1251, or utf8)', 10
504
                        db '/join      : join a channel', 10
531
                        db '/join       : join a channel', 10
505
                        db '/part      : part from a channel', 10
532
                        db '/part       : part from a channel', 10
506
                        db '/quit               : quit server', 10
533
                        db '/quit                : quit server', 10
507
                        db '/msg          : send a private message', 10
534
                        db '/msg           : send a private message', 10
508
                        db '/ctcp         : send a message using client to client protocol', 10
535
                        db '/ctcp          : send a message using client-to-client protocol', 10
509
                        db 10
536
                        db 10
510
                        db 'Other commands are send straight to server.', 10
537
                        db 'Other commands are sent straight to a server', 10
511
                        db 10, 0
538
                        db 10, 0
Line 512... Line 539...
512
 
539
 
513
str_welcome             db 3, '3 ___', 3, '7__________', 3, '6_________  ', 3, '4         __   __               __', 10
540
str_welcome             db 3, '3 ___', 3, '7__________', 3, '6_________  ', 3, '4         __   __               __', 10
514
                        db 3, '3|   \', 3, '7______   \', 3, '6_   ___ \ ', 3, '4   ____ |  | |__| ____   _____/  |_', 10
541
                        db 3, '3|   \', 3, '7______   \', 3, '6_   ___ \ ', 3, '4   ____ |  | |__| ____   _____/  |_', 10
Line 553... Line 580...
553
        dw AF_INET4
580
        dw AF_INET4
554
.port   dw 0x0b1a       ; 6667          FIXMEEEEEE
581
.port   dw 0x0b1a       ; 6667          FIXMEEEEEE
555
.ip     dd 0
582
.ip     dd 0
556
        rb 10
583
        rb 10
Line -... Line 584...
-
 
584
 
Line 557... Line 585...
557
 
585
SOCKADDR1_SIZE          = 18
Line 558... Line 586...
558
 
586
 
559
status                  dd STATUS_DISCONNECTED
587
status                  dd STATUS_DISCONNECTED
Line 599... Line 627...
599
.size           dd ?
627
.size           dd ?
Line 600... Line 628...
600
 
628
 
601
utf8_bytes_rest dd ?            ; bytes rest in current UTF8 sequence
629
utf8_bytes_rest dd ?            ; bytes rest in current UTF8 sequence
Line 602... Line 630...
602
utf8_char       dd ?            ; first bits of current UTF8 character
630
utf8_char       dd ?            ; first bits of current UTF8 character
603
 
631
 
604
packetbuf       rb 1024         ; buffer for packets to server
632
packetbuf       rb PACKETBUF_SIZE         ; buffer for packets to server
Line 605... Line 633...
605
path            rb 1024
633
path            rb PATH_SIZE
Line 606... Line 634...
606
param           rb 1024
634
param           rb PARAM_SIZE
607
 
635
 
608
servercommand   rb 600
636
servercommand   rb SERVERCOMMAND_SIZE
609
 
637
 
Line 620... Line 648...
620
irc_server_name rb MAX_SERVER_NAME      ; TODO: move this server URL into window struct
648
irc_server_name rb MAX_SERVER_NAME      ; TODO: move this server URL into window struct
621
socketnum       dd ?                    ; TODO: same for socket
649
socketnum       dd ?                    ; TODO: same for socket
Line 622... Line 650...
622
 
650
 
623
user_nick       rb MAX_NICK_LEN
651
user_nick       rb MAX_NICK_LEN
624
user_real_name  rb MAX_REAL_LEN
652
user_real_name  rb MAX_REAL_LEN
Line 625... Line 653...
625
quit_msg        rb 250
653
quit_msg        rb QUIT_MSG_LEN
Line 626... Line 654...
626
 
654
 
627
windows         rb MAX_WINDOWS*sizeof.window
655
windows         rb MAX_WINDOWS*sizeof.window