Rev 4824 | 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 | ;; ;; |
||
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] |
||
4828 | gtament | 420 | jne .not_low |
4824 | gtament | 421 | or [edi+window.flags], FLAG_SCROLL_LOW |
4828 | gtament | 422 | .not_low: |
423 | mov edx, [scroll2.position] |
||
4824 | gtament | 424 | sub edx, [edi + window.text_line_print] |
425 | je @f |
||
426 | call draw_channel_text.scroll_to_pos |
||
4143 | hidnplayr | 427 | @@: |
428 | |||
4824 | gtament | 429 | jmp mainloop |
3545 | hidnplayr | 430 | |
431 | |||
432 | ; DATA AREA |
||
433 | |||
434 | encoding_text: |
||
4824 | gtament | 435 | db 'CP866 ' |
436 | db 'CP1251' |
||
437 | db 'UTF-8 ' |
||
3545 | hidnplayr | 438 | encoding_text_len = 6 |
439 | |||
4824 | gtament | 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 | |
4824 | gtament | 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 | |
4824 | gtament | 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 | |
4824 | gtament | 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 | |
4824 | gtament | 479 | str_1 db 3, '13 -', 0 |
480 | str_2 db '- ', 0 |
||
4477 | hidnplayr | 481 | |
4824 | gtament | 482 | str_list db 'list', 0 |
4623 | hidnplayr | 483 | |
4824 | gtament | 484 | str_help db 'The following commands are available:', 10 |
485 | db 10 |
||
486 | db '/nick |
||
487 | db '/real |
||
488 | db '/server : connect to server', 10 |
||
489 | db '/code |
||
490 | db '/join |
||
491 | db '/part |
||
492 | db '/quit : quit server', 10 |
||
493 | db '/msg |
||
494 | db '/ctcp |
||
495 | db 10 |
||
496 | db 'Other commands are send straight to server.', 10 |
||
497 | db 10, 0 |
||
4477 | hidnplayr | 498 | |
4824 | gtament | 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 10 |
||
506 | db 'Welcome to the KolibriOS IRC client v', version, 10 |
||
507 | db 10 |
||
508 | db 'Type /help for help', 10, 10, 0 |
||
4477 | hidnplayr | 509 | |
4824 | gtament | 510 | str_version db 'VERSION ' |
511 | str_programname db 'KolibriOS IRC client v', version, 0 |
||
3545 | hidnplayr | 512 | |
4824 | gtament | 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 | |
4824 | gtament | 519 | default_nick db 'kolibri_user', 0 |
520 | default_real db 'Kolibri User', 0 |
||
521 | default_quit db 'KolibriOS forever', 0 |
||
3545 | hidnplayr | 522 | |
4824 | gtament | 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: |
4824 | gtament | 541 | dw AF_INET4 |
542 | .port dw 0x0b1a ; 6667 FIXMEEEEEE |
||
543 | .ip dd 0 |
||
544 | rb 10 |
||
3545 | hidnplayr | 545 | |
546 | |||
4824 | gtament | 547 | status dd STATUS_DISCONNECTED |
3545 | hidnplayr | 548 | |
4824 | gtament | 549 | window_active dd windows |
550 | window_print dd windows |
||
3545 | hidnplayr | 551 | |
552 | align 4 |
||
553 | @IMPORT: |
||
554 | |||
4824 | gtament | 555 | library network, 'network.obj',\ |
556 | libini, 'libini.obj',\ |
||
557 | boxlib, 'box_lib.obj' |
||
3545 | hidnplayr | 558 | |
4824 | gtament | 559 | import network,\ |
560 | getaddrinfo, 'getaddrinfo',\ |
||
561 | freeaddrinfo, 'freeaddrinfo',\ |
||
562 | inet_ntoa, 'inet_ntoa' |
||
3545 | hidnplayr | 563 | |
4824 | gtament | 564 | import libini,\ |
565 | ini.get_str, 'ini_get_str',\ |
||
566 | ini.get_int, 'ini_get_int' |
||
3545 | hidnplayr | 567 | |
4824 | gtament | 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 | |
4824 | gtament | 575 | ; width, left, top |
576 | edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25 |
||
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 | |
4824 | gtament | 581 | usercommand db '/server chat.freenode.net', 0 |
582 | rb MAX_COMMAND_LEN |
||
3618 | hidnplayr | 583 | |
4477 | hidnplayr | 584 | I_END: |
585 | |||
4824 | gtament | 586 | utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence |
587 | utf8_char dd ? ; first bits of current UTF8 character |
||
4477 | hidnplayr | 588 | |
4824 | gtament | 589 | packetbuf rb 1024 ; buffer for packets to server |
590 | path rb 1024 |
||
591 | param rb 1024 |
||
3545 | hidnplayr | 592 | |
4824 | gtament | 593 | servercommand rb 600 |
3545 | hidnplayr | 594 | |
4824 | gtament | 595 | thread_info process_information |
596 | xsize dd ? |
||
597 | ysize dd ? |
||
598 | mouse_dd dd ? |
||
3545 | hidnplayr | 599 | |
4824 | gtament | 600 | textbox_height dd ? ; in characters |
601 | textbox_width dd ? ; in characters, not pixels ;) |
||
4621 | hidnplayr | 602 | |
4824 | gtament | 603 | colors system_colors |
3545 | hidnplayr | 604 | |
4824 | gtament | 605 | irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct |
606 | socketnum dd ? ; TODO: same for socket |
||
3545 | hidnplayr | 607 | |
4824 | gtament | 608 | user_nick rb MAX_NICK_LEN |
609 | user_real_name rb MAX_REAL_LEN |
||
610 | quit_msg rb 250 |
||
3545 | hidnplayr | 611 | |
4824 | gtament | 612 | windows rb MAX_WINDOWS*sizeof.window |
3545 | hidnplayr | 613 | |
4623 | hidnplayr | 614 | IM_END: |