Subversion Repositories Kolibri OS

Rev

Rev 4828 | Rev 6026 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3545 hidnplayr 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
6023 hidnplayr 3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved.    ;;
3545 hidnplayr 4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
6
;;  IRC client for KolibriOS                                       ;;
7
;;                                                                 ;;
8
;;   Written by hidnplayr@kolibrios.org,                           ;;
9
;;     text encoder/decoder by Clevermouse.                        ;;
10
;;                                                                 ;;
11
;;         GNU GENERAL PUBLIC LICENSE                              ;;
12
;;          Version 2, June 1991                                   ;;
13
;;                                                                 ;;
14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15
 
6023 hidnplayr 16
version equ '0.24'
3545 hidnplayr 17
 
18
; connection status
6023 hidnplayr 19
STATUS_DISCONNECTED     = 0
20
STATUS_RESOLVING        = 1
21
STATUS_CONNECTING       = 2
22
STATUS_CONNECTED        = 3
3545 hidnplayr 23
 
24
; window flags
6023 hidnplayr 25
FLAG_UPDATED            = 1 shl 0
26
FLAG_RECEIVING_NAMES    = 1 shl 1
27
FLAG_SCROLL_LOW         = 1 shl 2
3545 hidnplayr 28
 
29
; window types
6023 hidnplayr 30
WINDOWTYPE_NONE         = 0
31
WINDOWTYPE_SERVER       = 1
32
WINDOWTYPE_CHANNEL      = 2
33
WINDOWTYPE_CHAT         = 3
34
WINDOWTYPE_LIST         = 4
35
WINDOWTYPE_DCC          = 5
3545 hidnplayr 36
 
37
; supported encodings
6023 hidnplayr 38
CP866                   = 0
39
CP1251                  = 1
40
UTF8                    = 2
3545 hidnplayr 41
 
42
; settings
6023 hidnplayr 43
USERCMD_MAX_SIZE        = 400
3545 hidnplayr 44
 
6023 hidnplayr 45
WIN_MIN_X               = 600
46
WIN_MIN_Y               = 170
3545 hidnplayr 47
 
6023 hidnplayr 48
TEXT_X                  = 5
49
TEXT_Y                  = TOP_Y + 2
3545 hidnplayr 50
 
6023 hidnplayr 51
TOP_SPACE               = 2
52
TAB_HEIGHT              = 14
53
TAB_WIDTH               = 120
54
TAB_SPACE               = 5
55
TOP_Y                   = TOP_SPACE+ TAB_HEIGHT
56
INPUTBOX_HEIGHT         = 13
3545 hidnplayr 57
 
6023 hidnplayr 58
MAX_WINDOWS             = 20
59
MAX_USERS               = 4096
60
TEXT_BUFFERSIZE         = 1024*1024
3545 hidnplayr 61
 
6023 hidnplayr 62
MAX_NICK_LEN            = 32
63
MAX_REAL_LEN            = 32    ; realname
64
MAX_SERVER_NAME         = 256
3545 hidnplayr 65
 
6023 hidnplayr 66
MAX_CHANNEL_LEN         = 40
67
MAX_CHANNELS            = 37
3545 hidnplayr 68
 
6023 hidnplayr 69
MAX_COMMAND_LEN         = 512
3545 hidnplayr 70
 
6023 hidnplayr 71
TIMESTAMP               = 3     ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
3545 hidnplayr 72
 
6023 hidnplayr 73
MAX_WINDOWNAME_LEN      = 256
3545 hidnplayr 74
 
6023 hidnplayr 75
WINDOW_BTN_START        = 100
76
WINDOW_BTN_CLOSE        = 2
77
WINDOW_BTN_LIST         = 3
3545 hidnplayr 78
 
6023 hidnplayr 79
SCROLLBAR_WIDTH         = 14
80
USERLIST_WIDTH          = 100
3545 hidnplayr 81
 
6023 hidnplayr 82
FONT_HEIGHT             = 9
83
FONT_WIDTH              = 6
3545 hidnplayr 84
 
85
format binary as ""
86
 
87
use32
88
 
6023 hidnplayr 89
        org     0x0
3545 hidnplayr 90
 
6023 hidnplayr 91
        db      'MENUET01'              ; 8 byte id
92
        dd      1                       ; header version
93
        dd      START                   ; program start
94
        dd      I_END                   ; program image size
95
        dd      IM_END+2048             ; required amount of memory
96
        dd      IM_END+2048
97
        dd      param
98
        dd      path
3545 hidnplayr 99
 
3618 hidnplayr 100
include "../../macros.inc"
101
include "../../proc32.inc"
102
include "../../dll.inc"
103
include "../../network.inc"
104
include "../../struct.inc"
4477 hidnplayr 105
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
3545 hidnplayr 106
 
6023 hidnplayr 107
struct  window
108
        data_ptr        dd ?
109
        flags           db ?
110
        type            db ?
111
        name            rb MAX_WINDOWNAME_LEN
112
        users           dd ?
113
        users_scroll    dd ?
114
        selected        dd ?            ; selected user, 0 if none selected
4143 hidnplayr 115
 
6023 hidnplayr 116
        text_start      dd ?            ; pointer to current textbox data
117
        text_end        dd ?
118
        text_print      dd ?            ; pointer to first character to print on screen
119
        text_line_print dd ?            ; line number of that character
120
        text_write      dd ?            ; write pointer
121
        text_lines      dd ?            ; total number of lines
122
        text_scanned    dd ?            ; pointer to beginning of unscanned data (we still need to count number of lines, insert newline characters,..)
4143 hidnplayr 123
 
3545 hidnplayr 124
ends
125
 
6023 hidnplayr 126
struct  window_data
127
        text            rb TEXT_BUFFERSIZE
128
        names           rb MAX_NICK_LEN * MAX_USERS
3545 hidnplayr 129
ends
130
 
131
include "encodings.inc"
4143 hidnplayr 132
include "window.inc"
3545 hidnplayr 133
include "serverparser.inc"
134
include "userparser.inc"
135
include "socket.inc"
136
include "gui.inc"
137
include "users.inc"
4060 hidnplayr 138
include "textbox.inc"
3545 hidnplayr 139
 
140
 
141
START:
142
 
6023 hidnplayr 143
        mcall   68, 11                  ; init heap so we can allocate memory dynamically
3545 hidnplayr 144
 
145
; wanted events
6023 hidnplayr 146
        mcall   40, EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_STACK+EVM_MOUSE+EVM_MOUSE_FILTER
3545 hidnplayr 147
 
148
; load libraries
6023 hidnplayr 149
        stdcall dll.Load, @IMPORT
150
        test    eax, eax
151
        jnz     exit
3545 hidnplayr 152
 
153
; find path to main settings file (ircc.ini)
6023 hidnplayr 154
        mov     edi, path               ; Calculate the length of zero-terminated string
155
        xor     al, al
156
        mov     ecx, 1024
157
        repne   scasb
158
        dec     edi
159
        mov     eax, '.ini'
160
        stosd
161
        xor     al, al
162
        stosb
3545 hidnplayr 163
 
164
; Fill the window buffer with zeros
6023 hidnplayr 165
        mov     edi, windows
166
        mov     ecx, (sizeof.window*MAX_WINDOWS+3)/4
167
        xor     eax, eax
168
        rep     stosd
3545 hidnplayr 169
 
170
; clear command area too
6023 hidnplayr 171
        mov     edi, servercommand
172
        mov     ecx, 600/4
173
        rep     stosd
3545 hidnplayr 174
 
175
; allocate window data block
6023 hidnplayr 176
        mov     ebx, windows
177
        call    window_create_textbox
178
        test    eax, eax
179
        jz      error
180
        mov     [ebx + window.type], WINDOWTYPE_SERVER
3545 hidnplayr 181
 
182
; get system colors
6023 hidnplayr 183
        mcall   48, 3, colors, 40
3545 hidnplayr 184
 
185
; set edit box and scrollbar colors
6023 hidnplayr 186
        mov     eax, [colors.work]
187
        mov     [scroll1.bg_color], eax
188
        mov     [scroll2.bg_color], eax
3545 hidnplayr 189
 
6023 hidnplayr 190
        mov     eax, [colors.work_button]
191
        mov     [scroll1.front_color], eax
192
        mov     [scroll2.front_color], eax
3545 hidnplayr 193
 
6023 hidnplayr 194
        mov     eax, [colors.work_text]
195
        mov     [scroll1.line_color], eax
196
        mov     [scroll2.line_color], eax
3545 hidnplayr 197
 
6023 hidnplayr 198
        mov     [scroll1.type], 1               ; 0 = simple, 1 = skinned
199
        mov     [scroll2.type], 1
4143 hidnplayr 200
 
3545 hidnplayr 201
; get settings from ini
6023 hidnplayr 202
        invoke  ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick
203
        invoke  ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real
204
        invoke  ini.get_str, path, str_user, str_quitmsg, quit_msg, 250, default_quit
3545 hidnplayr 205
 
206
; Welcome user
6023 hidnplayr 207
        mov     esi, str_welcome
208
        call    print_asciiz
3545 hidnplayr 209
 
4477 hidnplayr 210
; Check if parameter contains an URL
6023 hidnplayr 211
        cmp     byte[param], 0
212
        je      @f
213
        mov     esi, param
214
        mov     ecx, 1024
215
        call    cmd_usr_server.now
4477 hidnplayr 216
  @@:
3545 hidnplayr 217
 
4477 hidnplayr 218
; Draw window a first time, so we can figure out skin size
6023 hidnplayr 219
        call    draw_window
4477 hidnplayr 220
 
3545 hidnplayr 221
redraw:
6023 hidnplayr 222
        call    draw_window
3545 hidnplayr 223
 
4477 hidnplayr 224
mainloop:
6023 hidnplayr 225
        mcall   10              ; wait for event
3545 hidnplayr 226
 
6023 hidnplayr 227
        dec     eax
228
        jz      redraw
3545 hidnplayr 229
 
6023 hidnplayr 230
        dec     eax
231
        jz      main_window_key
3545 hidnplayr 232
 
6023 hidnplayr 233
        dec     eax
234
        jz      button
3545 hidnplayr 235
 
6023 hidnplayr 236
        cmp     al, 3
237
        je      mouse
3545 hidnplayr 238
 
6023 hidnplayr 239
        call    process_network_event
3545 hidnplayr 240
 
6023 hidnplayr 241
        mov     edi, [window_active]
242
        test    [edi + window.flags], FLAG_UPDATED
243
        jz      .no_update
244
        call    draw_channel_text
245
        mov     edi, [window_active]
246
        cmp     [edi + window.type], WINDOWTYPE_CHANNEL
247
        jne     .no_update
248
        call    draw_channel_list
3545 hidnplayr 249
  .no_update:
6023 hidnplayr 250
        call    highlight_updated_tabs
3545 hidnplayr 251
 
6023 hidnplayr 252
        jmp     mainloop
3545 hidnplayr 253
 
254
button:
255
 
6023 hidnplayr 256
        mcall   17              ; get id
257
        ror     eax, 8
3545 hidnplayr 258
 
6023 hidnplayr 259
        cmp     ax, 1           ; close program
260
        je      exit
3545 hidnplayr 261
 
6023 hidnplayr 262
        cmp     ax, WINDOW_BTN_CLOSE
263
        jne     @f
264
        call    cmd_usr_close_window
265
        jmp     mainloop
3981 hidnplayr 266
 
267
  @@:
6023 hidnplayr 268
        cmp     ax, WINDOW_BTN_LIST
269
        jne     @f
3981 hidnplayr 270
 
6023 hidnplayr 271
        push    eax
3981 hidnplayr 272
 
6023 hidnplayr 273
        mcall   37, 1           ; Get mouse position
274
        sub     ax, TEXT_Y
275
        mov     bl, FONT_HEIGHT
276
        div     bl
277
        and     eax, 0x000000ff
278
        inc     eax
279
        add     eax, [scroll1.position]
280
        mov     ebx, [window_active]
281
        mov     [ebx + window.selected], eax
3545 hidnplayr 282
 
6023 hidnplayr 283
        call    draw_channel_list
3545 hidnplayr 284
 
6023 hidnplayr 285
        pop     eax
286
        test    eax, 1 shl 25   ; Right mouse button pressed?
287
        jz      mainloop
3981 hidnplayr 288
 
4477 hidnplayr 289
; TODO: check if selected nick is my nick!
290
 
3981 hidnplayr 291
; Right mouse BTN was pressed, open chat window
6023 hidnplayr 292
        mov     ebx, [window_active]
293
        mov     eax, [ebx + window.selected]
294
        dec     eax
295
        imul    eax, MAX_NICK_LEN
296
        mov     ebx, [ebx + window.data_ptr]
297
        lea     esi, [ebx + window_data.names + eax]
298
        call    window_open
299
        test    ebx, ebx
300
        jz      mainloop
301
        mov     [window_active], ebx
302
        call    redraw
3981 hidnplayr 303
 
6023 hidnplayr 304
        jmp     mainloop
3545 hidnplayr 305
 
306
  @@:
6023 hidnplayr 307
        sub     ax, WINDOW_BTN_START
308
        jb      exit
3545 hidnplayr 309
 
6023 hidnplayr 310
        cmp     ax, MAX_WINDOWS
311
        ja      exit
3545 hidnplayr 312
 
4623 hidnplayr 313
; Save users scrollbar position
6023 hidnplayr 314
        push    [scroll1.position]
315
        mov     edx, [window_active]
316
        pop     [edx + window.users_scroll]
4623 hidnplayr 317
 
4143 hidnplayr 318
; OK, time to switch to another window.
6023 hidnplayr 319
        mov     dx, sizeof.window
320
        mul     dx
321
        shl     edx, 16
322
        mov     dx, ax
323
        add     edx, windows
324
        cmp     [edx + window.type], WINDOWTYPE_NONE
325
        je      exit
326
        mov     [window_active], edx
4143 hidnplayr 327
 
6023 hidnplayr 328
        push    [edx + window.text_line_print]
329
        pop     [scroll2.position]
4621 hidnplayr 330
 
6023 hidnplayr 331
        push    [edx + window.users_scroll]
332
        pop     [scroll1.position]
4623 hidnplayr 333
 
6023 hidnplayr 334
        call    draw_window
335
        jmp     mainloop
3981 hidnplayr 336
 
3545 hidnplayr 337
exit:
3981 hidnplayr 338
 
6023 hidnplayr 339
        cmp     [socketnum], 0
340
        je      @f
341
        mov     esi, quit_msg
342
        call    quit_server
3981 hidnplayr 343
  @@:
344
 
4143 hidnplayr 345
error:
346
 
6023 hidnplayr 347
        mcall   -1
3545 hidnplayr 348
 
349
 
350
 
351
main_window_key:
352
 
6023 hidnplayr 353
        mcall   2
3545 hidnplayr 354
 
6023 hidnplayr 355
        push    dword edit1
356
        call    [edit_box_key]
3545 hidnplayr 357
 
4143 hidnplayr 358
;        cmp     ah, 178
359
;        jne     .no_up
360
;
4477 hidnplayr 361
;        jmp     mainloop
4143 hidnplayr 362
;
363
;
364
;  .no_up:
365
;        cmp     ah, 177
366
;        jne     .no_down
367
;
4477 hidnplayr 368
;        jmp     mainloop
4143 hidnplayr 369
;
370
;  .no_down:
6023 hidnplayr 371
        cmp     ah, 13          ; enter
372
        jne     no_send2
3545 hidnplayr 373
 
6023 hidnplayr 374
        call    user_parser
3545 hidnplayr 375
 
6023 hidnplayr 376
        mov     eax, [edit1.size]
4143 hidnplayr 377
 
6023 hidnplayr 378
        mov     [edit1.size], 0
379
        mov     [edit1.pos], 0
3545 hidnplayr 380
 
6023 hidnplayr 381
        push    dword edit1
382
        call    [edit_box_draw]
3545 hidnplayr 383
 
6023 hidnplayr 384
        call    draw_channel_text
3545 hidnplayr 385
 
6023 hidnplayr 386
        jmp     mainloop
3545 hidnplayr 387
  no_send2:
388
 
6023 hidnplayr 389
        jmp     mainloop
3545 hidnplayr 390
 
391
mouse:
6023 hidnplayr 392
        push    dword edit1
393
        call    [edit_box_mouse]
3545 hidnplayr 394
 
4477 hidnplayr 395
;        mcall   37, 7
396
;        movsx   eax, ax
397
;        add     [scroll2.position], eax
398
 
4143 hidnplayr 399
; TODO: check if scrollbar is active?
6023 hidnplayr 400
        mov     edi, [window_active]
401
        cmp     [edi + window.type], WINDOWTYPE_CHANNEL
402
        jne     @f
403
        push    [scroll1.position]
404
        push    dword scroll1
405
        call    [scrollbar_mouse]
406
        pop     eax
407
        cmp     eax, [scroll1.position] ; did the scrollbar move?
408
        je      @f
409
        call    draw_channel_list
3545 hidnplayr 410
  @@:
411
 
4143 hidnplayr 412
; TODO: check if scrollbar is active?
6023 hidnplayr 413
        mov     edi, [window_active]
414
        mov     eax, [edi + window.text_lines]
415
        cmp     eax, [textbox_height]
416
        jbe     @f
417
        push    dword scroll2
418
        call    [scrollbar_mouse]
419
        mov     edi, [window_active]
420
        and     [edi+window.flags], not FLAG_SCROLL_LOW
421
        mov     edx, [scroll2.position]
422
        add     edx, [scroll2.cur_area]
423
        sub     edx, [scroll2.max_area]
424
        jne     .not_low
425
        or      [edi+window.flags], FLAG_SCROLL_LOW
4828 gtament 426
  .not_low:
6023 hidnplayr 427
        mov     edx, [scroll2.position]
428
        sub     edx, [edi + window.text_line_print]
429
        je      @f
430
        call    draw_channel_text.scroll_to_pos
4143 hidnplayr 431
  @@:
432
 
6023 hidnplayr 433
        jmp     mainloop
3545 hidnplayr 434
 
435
 
436
; DATA AREA
437
 
438
encoding_text:
6023 hidnplayr 439
db      'CP866 '
440
db      'CP1251'
441
db      'UTF-8 '
3545 hidnplayr 442
encoding_text_len = 6
443
 
6023 hidnplayr 444
join_header             db 3, '3* ', 0
445
quit_header             db 3, '5* ', 0
446
nick_header             db 3, '2* ', 0
447
kick_header             db 3, '5* ', 0
448
mode_header             db 3, '2* ', 0
449
part_header             db 3, '5* ', 0
450
topic_header            db 3, '3* ', 0
451
action_header           db 3, '6* ', 0
452
ctcp_header             db 3, '13-> [', 0
453
msg_header              db 3, '7-> *', 0
454
ctcp_version            db '] VERSION', 10, 0
455
ctcp_ping               db '] PING', 10, 0
456
ctcp_time               db '] TIME', 10, 0
4477 hidnplayr 457
 
6023 hidnplayr 458
has_left_channel        db ' has left ', 0
459
joins_channel           db ' has joined ', 0
460
is_now_known_as         db ' is now known as ', 0
461
has_quit_irc            db ' has quit IRC', 10, 0
4477 hidnplayr 462
 
6023 hidnplayr 463
sets_mode               db ' sets mode ', 0
464
str_kicked              db ' is kicked from ', 0
465
str_by                  db ' by ', 0
466
str_nickchange          db 'Nickname is now ', 0
467
str_realchange          db 'Real name is now ', 0
468
str_talking             db 'Now talking in ', 0
469
str_topic               db 'Topic is "', 0
470
str_topic_end           db '"', 10, 0
471
str_setby               db 'Set by ', 0
3545 hidnplayr 472
 
6023 hidnplayr 473
str_connecting          db 3, '3* Connecting to ', 0
474
str_sockerr             db 3, '5* Socket error', 10, 0
475
str_dnserr              db 3, '5* Unable to resolve hostname', 10, 0
476
str_refused             db 3, '5* Connection refused', 10, 0
477
str_srv_disconnected    db 3, '5* Server disconnected', 10, 0
478
str_disconnected        db 3, '5* Disconnected', 10, 0
479
str_reconnect           db 3, '5* Connection reset by user', 10, 0
480
str_notconnected        db 3, '5* Not connected to server', 10, 0
481
str_notchannel          db 3, '5* You are not on a channel', 10, 0
4477 hidnplayr 482
 
6023 hidnplayr 483
str_1                   db 3, '13 -', 0
484
str_2                   db '- ', 0
4477 hidnplayr 485
 
6023 hidnplayr 486
str_list                db 'list', 0
4623 hidnplayr 487
 
6023 hidnplayr 488
str_help                db 'The following commands are available:', 10
489
                        db 10
490
                        db '/nick         : change nickname', 10
491
                        db '/real    : change real name', 10
492
                        db '/server 
: connect to server', 10
493
                        db '/code         : change codepage (cp866, cp1251, or utf8)', 10
494
                        db '/join      : join a channel', 10
495
                        db '/part      : part from a channel', 10
496
                        db '/quit               : quit server', 10
497
                        db '/msg          : send a private message', 10
498
                        db '/ctcp         : send a message using client to client protocol', 10
499
                        db 10
500
                        db 'Other commands are send straight to server.', 10
501
                        db 10, 0
4477 hidnplayr 502
 
6023 hidnplayr 503
str_welcome             db 3, '3 ___', 3, '7__________', 3, '6_________  ', 3, '4         __   __               __', 10
504
                        db 3, '3|   \', 3, '7______   \', 3, '6_   ___ \ ', 3, '4   ____ |  | |__| ____   _____/  |_', 10
505
                        db 3, '3|   |', 3, '7|       _/', 3, '6    \  \/ ', 3, '4 _/ ___\|  | |  |/ __ \ /    \   __\', 10
506
                        db 3, '3|   |', 3, '7|    |   \', 3, '6     \____', 3, '4 \  \___|  |_|  \  ___/|   |  \  |', 10
507
                        db 3, '3|___|', 3, '7|____|_  /', 3, '6\______  /', 3, '4  \___  >____/__|\___  >___|  /__|', 10
508
                        db 3, '3     ', 3, '7       \/ ', 3, '6       \/ ', 3, '4      \/             \/     \/', 10
509
                        db 10
510
                        db 'Welcome to KolibriOS IRC client ', version, 10
511
                        db 10
512
                        db 'Type /help for help', 10, 10, 0
4477 hidnplayr 513
 
6023 hidnplayr 514
str_version             db 'VERSION KolibriOS '
515
str_programname         db 'IRC client ', version, 0
3545 hidnplayr 516
 
6023 hidnplayr 517
str_user                db 'user', 0
518
str_nick                db 'nick', 0
519
str_real                db 'realname', 0
520
str_email               db 'email', 0
521
str_quitmsg             db 'quitmsg', 0
3545 hidnplayr 522
 
6023 hidnplayr 523
default_nick            db 'kolibri_user', 0
524
default_real            db 'Kolibri User', 0
525
default_quit            db 'KolibriOS forever', 0
3545 hidnplayr 526
 
6023 hidnplayr 527
irc_colors              dd 0xffffff     ;  0 white
528
                        dd 0x000000     ;  1 black
529
                        dd 0x00007f     ;  2 blue (navy)
530
                        dd 0x009300     ;  3 green
531
                        dd 0xff0000     ;  4 red
532
                        dd 0x7f0000     ;  5 brown (maroon)
533
                        dd 0x9c009c     ;  6 purple
534
                        dd 0xfc7f00     ;  7 olive
535
                        dd 0xffff00     ;  8 yellow
536
                        dd 0x00fc00     ;  9 light green
537
                        dd 0x009393     ; 10 teal
538
                        dd 0x00ffff     ; 11 cyan
539
                        dd 0x0000fc     ; 12 royal blue
540
                        dd 0xff00ff     ; 13 pink
541
                        dd 0x7f7f7f     ; 14 grey
542
                        dd 0xd4d0c4     ; 15 light grey (silver)
4143 hidnplayr 543
 
3545 hidnplayr 544
sockaddr1:
6023 hidnplayr 545
        dw AF_INET4
546
.port   dw 0x0b1a       ; 6667          FIXMEEEEEE
547
.ip     dd 0
548
        rb 10
3545 hidnplayr 549
 
550
 
6023 hidnplayr 551
status                  dd STATUS_DISCONNECTED
3545 hidnplayr 552
 
6023 hidnplayr 553
window_active           dd windows
554
window_print            dd windows
3545 hidnplayr 555
 
556
align 4
557
@IMPORT:
558
 
6023 hidnplayr 559
library network,        'network.obj',\
560
        libini,         'libini.obj',\
561
        boxlib,         'box_lib.obj'
3545 hidnplayr 562
 
6023 hidnplayr 563
import  network,\
564
        getaddrinfo,    'getaddrinfo',\
565
        freeaddrinfo,   'freeaddrinfo',\
566
        inet_ntoa,      'inet_ntoa'
3545 hidnplayr 567
 
6023 hidnplayr 568
import  libini,\
569
        ini.get_str,    'ini_get_str',\
570
        ini.get_int,    'ini_get_int'
3545 hidnplayr 571
 
6023 hidnplayr 572
import  boxlib,\
573
        edit_box_draw,  'edit_box',\
574
        edit_box_key,   'edit_box_key',\
575
        edit_box_mouse, 'edit_box_mouse',\
576
        scrollbar_draw, 'scrollbar_v_draw',\
577
        scrollbar_mouse,'scrollbar_v_mouse'
3545 hidnplayr 578
 
6023 hidnplayr 579
        ;         width, left, top
580
edit1   edit_box  0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25
581
        ;         xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol
4143 hidnplayr 582
scroll1 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
583
scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
3545 hidnplayr 584
 
6023 hidnplayr 585
usercommand     db '/server chat.freenode.net', 0
586
                rb MAX_COMMAND_LEN
3618 hidnplayr 587
 
4477 hidnplayr 588
I_END:
589
 
6023 hidnplayr 590
utf8_bytes_rest dd ?            ; bytes rest in current UTF8 sequence
591
utf8_char       dd ?            ; first bits of current UTF8 character
4477 hidnplayr 592
 
6023 hidnplayr 593
packetbuf       rb 1024         ; buffer for packets to server
594
path            rb 1024
595
param           rb 1024
3545 hidnplayr 596
 
6023 hidnplayr 597
servercommand   rb 600
3545 hidnplayr 598
 
6023 hidnplayr 599
thread_info     process_information
600
xsize           dd ?
601
ysize           dd ?
602
mouse_dd        dd ?
3545 hidnplayr 603
 
6023 hidnplayr 604
textbox_height  dd ?            ; in characters
605
textbox_width   dd ?            ; in characters, not pixels ;)
4621 hidnplayr 606
 
6023 hidnplayr 607
colors          system_colors
3545 hidnplayr 608
 
6023 hidnplayr 609
irc_server_name rb MAX_SERVER_NAME      ; TODO: move this server URL into window struct
610
socketnum       dd ?                    ; TODO: same for socket
3545 hidnplayr 611
 
6023 hidnplayr 612
user_nick       rb MAX_NICK_LEN
613
user_real_name  rb MAX_REAL_LEN
614
quit_msg        rb 250
3545 hidnplayr 615
 
6023 hidnplayr 616
windows         rb MAX_WINDOWS*sizeof.window
3545 hidnplayr 617
 
4623 hidnplayr 618
IM_END: