Subversion Repositories Kolibri OS

Rev

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

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