Subversion Repositories Kolibri OS

Rev

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