Subversion Repositories Kolibri OS

Rev

Rev 6023 | Rev 6027 | 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
 
6026 hidnplayr 16
version equ '0.25'
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
6026 hidnplayr 46
WIN_MIN_Y               = 183
3545 hidnplayr 47
 
6026 hidnplayr 48
TEXT_X                  = 2
6023 hidnplayr 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
6026 hidnplayr 80
USERLIST_WIDTH          = 160
3545 hidnplayr 81
 
6026 hidnplayr 82
FONT_WIDTH              = 8
83
FONT_HEIGHT             = 16
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
6026 hidnplayr 248
        call    draw_user_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
 
6026 hidnplayr 283
        call    draw_user_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
 
6026 hidnplayr 381
        invoke  edit_box_draw, edit1
3545 hidnplayr 382
 
6023 hidnplayr 383
        call    draw_channel_text
3545 hidnplayr 384
 
6023 hidnplayr 385
        jmp     mainloop
3545 hidnplayr 386
  no_send2:
387
 
6023 hidnplayr 388
        jmp     mainloop
3545 hidnplayr 389
 
390
mouse:
6026 hidnplayr 391
        invoke  edit_box_mouse, edit1
3545 hidnplayr 392
 
4477 hidnplayr 393
;        mcall   37, 7
394
;        movsx   eax, ax
395
;        add     [scroll2.position], eax
396
 
4143 hidnplayr 397
; TODO: check if scrollbar is active?
6023 hidnplayr 398
        mov     edi, [window_active]
399
        cmp     [edi + window.type], WINDOWTYPE_CHANNEL
400
        jne     @f
401
        push    [scroll1.position]
6026 hidnplayr 402
        invoke  scrollbar_mouse, scroll1
6023 hidnplayr 403
        pop     eax
404
        cmp     eax, [scroll1.position] ; did the scrollbar move?
405
        je      @f
6026 hidnplayr 406
        call    draw_user_list
3545 hidnplayr 407
  @@:
408
 
4143 hidnplayr 409
; TODO: check if scrollbar is active?
6023 hidnplayr 410
        mov     edi, [window_active]
411
        mov     eax, [edi + window.text_lines]
412
        cmp     eax, [textbox_height]
413
        jbe     @f
6026 hidnplayr 414
        invoke  scrollbar_mouse, scroll2
6023 hidnplayr 415
        mov     edi, [window_active]
416
        and     [edi+window.flags], not FLAG_SCROLL_LOW
417
        mov     edx, [scroll2.position]
418
        add     edx, [scroll2.cur_area]
419
        sub     edx, [scroll2.max_area]
420
        jne     .not_low
421
        or      [edi+window.flags], FLAG_SCROLL_LOW
4828 gtament 422
  .not_low:
6023 hidnplayr 423
        mov     edx, [scroll2.position]
424
        sub     edx, [edi + window.text_line_print]
425
        je      @f
426
        call    draw_channel_text.scroll_to_pos
4143 hidnplayr 427
  @@:
428
 
6023 hidnplayr 429
        jmp     mainloop
3545 hidnplayr 430
 
431
 
432
; DATA AREA
433
 
434
encoding_text:
6023 hidnplayr 435
db      'CP866 '
436
db      'CP1251'
437
db      'UTF-8 '
3545 hidnplayr 438
encoding_text_len = 6
439
 
6023 hidnplayr 440
join_header             db 3, '3* ', 0
441
quit_header             db 3, '5* ', 0
442
nick_header             db 3, '2* ', 0
443
kick_header             db 3, '5* ', 0
444
mode_header             db 3, '2* ', 0
445
part_header             db 3, '5* ', 0
446
topic_header            db 3, '3* ', 0
447
action_header           db 3, '6* ', 0
448
ctcp_header             db 3, '13-> [', 0
449
msg_header              db 3, '7-> *', 0
450
ctcp_version            db '] VERSION', 10, 0
451
ctcp_ping               db '] PING', 10, 0
452
ctcp_time               db '] TIME', 10, 0
4477 hidnplayr 453
 
6023 hidnplayr 454
has_left_channel        db ' has left ', 0
455
joins_channel           db ' has joined ', 0
456
is_now_known_as         db ' is now known as ', 0
457
has_quit_irc            db ' has quit IRC', 10, 0
4477 hidnplayr 458
 
6023 hidnplayr 459
sets_mode               db ' sets mode ', 0
460
str_kicked              db ' is kicked from ', 0
461
str_by                  db ' by ', 0
462
str_nickchange          db 'Nickname is now ', 0
463
str_realchange          db 'Real name is now ', 0
464
str_talking             db 'Now talking in ', 0
465
str_topic               db 'Topic is "', 0
466
str_topic_end           db '"', 10, 0
467
str_setby               db 'Set by ', 0
3545 hidnplayr 468
 
6023 hidnplayr 469
str_connecting          db 3, '3* Connecting to ', 0
470
str_sockerr             db 3, '5* Socket error', 10, 0
471
str_dnserr              db 3, '5* Unable to resolve hostname', 10, 0
472
str_refused             db 3, '5* Connection refused', 10, 0
473
str_srv_disconnected    db 3, '5* Server disconnected', 10, 0
474
str_disconnected        db 3, '5* Disconnected', 10, 0
475
str_reconnect           db 3, '5* Connection reset by user', 10, 0
476
str_notconnected        db 3, '5* Not connected to server', 10, 0
477
str_notchannel          db 3, '5* You are not on a channel', 10, 0
4477 hidnplayr 478
 
6023 hidnplayr 479
str_1                   db 3, '13 -', 0
480
str_2                   db '- ', 0
4477 hidnplayr 481
 
6023 hidnplayr 482
str_list                db 'list', 0
4623 hidnplayr 483
 
6023 hidnplayr 484
str_help                db 'The following commands are available:', 10
485
                        db 10
486
                        db '/nick         : change nickname', 10
487
                        db '/real    : change real name', 10
488
                        db '/server 
: connect to server', 10
489
                        db '/code         : change codepage (cp866, cp1251, or utf8)', 10
490
                        db '/join      : join a channel', 10
491
                        db '/part      : part from a channel', 10
492
                        db '/quit               : quit server', 10
493
                        db '/msg          : send a private message', 10
494
                        db '/ctcp         : send a message using client to client protocol', 10
495
                        db 10
496
                        db 'Other commands are send straight to server.', 10
497
                        db 10, 0
4477 hidnplayr 498
 
6023 hidnplayr 499
str_welcome             db 3, '3 ___', 3, '7__________', 3, '6_________  ', 3, '4         __   __               __', 10
500
                        db 3, '3|   \', 3, '7______   \', 3, '6_   ___ \ ', 3, '4   ____ |  | |__| ____   _____/  |_', 10
501
                        db 3, '3|   |', 3, '7|       _/', 3, '6    \  \/ ', 3, '4 _/ ___\|  | |  |/ __ \ /    \   __\', 10
502
                        db 3, '3|   |', 3, '7|    |   \', 3, '6     \____', 3, '4 \  \___|  |_|  \  ___/|   |  \  |', 10
503
                        db 3, '3|___|', 3, '7|____|_  /', 3, '6\______  /', 3, '4  \___  >____/__|\___  >___|  /__|', 10
504
                        db 3, '3     ', 3, '7       \/ ', 3, '6       \/ ', 3, '4      \/             \/     \/', 10
505
                        db 'Welcome to KolibriOS IRC client ', version, 10
6026 hidnplayr 506
                        db 'Type /help for help', 10, 0
4477 hidnplayr 507
 
6023 hidnplayr 508
str_version             db 'VERSION KolibriOS '
509
str_programname         db 'IRC client ', version, 0
3545 hidnplayr 510
 
6023 hidnplayr 511
str_user                db 'user', 0
512
str_nick                db 'nick', 0
513
str_real                db 'realname', 0
514
str_email               db 'email', 0
515
str_quitmsg             db 'quitmsg', 0
3545 hidnplayr 516
 
6023 hidnplayr 517
default_nick            db 'kolibri_user', 0
518
default_real            db 'Kolibri User', 0
519
default_quit            db 'KolibriOS forever', 0
3545 hidnplayr 520
 
6023 hidnplayr 521
irc_colors              dd 0xffffff     ;  0 white
522
                        dd 0x000000     ;  1 black
523
                        dd 0x00007f     ;  2 blue (navy)
524
                        dd 0x009300     ;  3 green
525
                        dd 0xff0000     ;  4 red
526
                        dd 0x7f0000     ;  5 brown (maroon)
527
                        dd 0x9c009c     ;  6 purple
528
                        dd 0xfc7f00     ;  7 olive
529
                        dd 0xffff00     ;  8 yellow
530
                        dd 0x00fc00     ;  9 light green
531
                        dd 0x009393     ; 10 teal
532
                        dd 0x00ffff     ; 11 cyan
533
                        dd 0x0000fc     ; 12 royal blue
534
                        dd 0xff00ff     ; 13 pink
535
                        dd 0x7f7f7f     ; 14 grey
536
                        dd 0xd4d0c4     ; 15 light grey (silver)
4143 hidnplayr 537
 
3545 hidnplayr 538
sockaddr1:
6023 hidnplayr 539
        dw AF_INET4
540
.port   dw 0x0b1a       ; 6667          FIXMEEEEEE
541
.ip     dd 0
542
        rb 10
3545 hidnplayr 543
 
544
 
6023 hidnplayr 545
status                  dd STATUS_DISCONNECTED
3545 hidnplayr 546
 
6023 hidnplayr 547
window_active           dd windows
548
window_print            dd windows
3545 hidnplayr 549
 
550
align 4
551
@IMPORT:
552
 
6023 hidnplayr 553
library network,        'network.obj',\
554
        libini,         'libini.obj',\
555
        boxlib,         'box_lib.obj'
3545 hidnplayr 556
 
6023 hidnplayr 557
import  network,\
558
        getaddrinfo,    'getaddrinfo',\
559
        freeaddrinfo,   'freeaddrinfo',\
560
        inet_ntoa,      'inet_ntoa'
3545 hidnplayr 561
 
6023 hidnplayr 562
import  libini,\
563
        ini.get_str,    'ini_get_str',\
564
        ini.get_int,    'ini_get_int'
3545 hidnplayr 565
 
6023 hidnplayr 566
import  boxlib,\
567
        edit_box_draw,  'edit_box',\
568
        edit_box_key,   'edit_box_key',\
569
        edit_box_mouse, 'edit_box_mouse',\
570
        scrollbar_draw, 'scrollbar_v_draw',\
571
        scrollbar_mouse,'scrollbar_v_mouse'
3545 hidnplayr 572
 
6023 hidnplayr 573
        ;         width, left, top
6026 hidnplayr 574
edit1   edit_box  0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0x000000, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25
6023 hidnplayr 575
        ;         xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol
4143 hidnplayr 576
scroll1 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
577
scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
3545 hidnplayr 578
 
6023 hidnplayr 579
usercommand     db '/server chat.freenode.net', 0
580
                rb MAX_COMMAND_LEN
3618 hidnplayr 581
 
4477 hidnplayr 582
I_END:
583
 
6023 hidnplayr 584
utf8_bytes_rest dd ?            ; bytes rest in current UTF8 sequence
585
utf8_char       dd ?            ; first bits of current UTF8 character
4477 hidnplayr 586
 
6023 hidnplayr 587
packetbuf       rb 1024         ; buffer for packets to server
588
path            rb 1024
589
param           rb 1024
3545 hidnplayr 590
 
6023 hidnplayr 591
servercommand   rb 600
3545 hidnplayr 592
 
6023 hidnplayr 593
thread_info     process_information
594
xsize           dd ?
595
ysize           dd ?
596
mouse_dd        dd ?
3545 hidnplayr 597
 
6023 hidnplayr 598
textbox_height  dd ?            ; in characters
599
textbox_width   dd ?            ; in characters, not pixels ;)
4621 hidnplayr 600
 
6023 hidnplayr 601
colors          system_colors
3545 hidnplayr 602
 
6023 hidnplayr 603
irc_server_name rb MAX_SERVER_NAME      ; TODO: move this server URL into window struct
604
socketnum       dd ?                    ; TODO: same for socket
3545 hidnplayr 605
 
6023 hidnplayr 606
user_nick       rb MAX_NICK_LEN
607
user_real_name  rb MAX_REAL_LEN
608
quit_msg        rb 250
3545 hidnplayr 609
 
6023 hidnplayr 610
windows         rb MAX_WINDOWS*sizeof.window
3545 hidnplayr 611
 
4623 hidnplayr 612
IM_END: