Rev 3545 | Rev 3549 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3545 | Rev 3548 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; IRC client for KolibriOS ;; |
6 | ;; IRC client for KolibriOS ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Written by hidnplayr@kolibrios.org, ;; |
8 | ;; Written by hidnplayr@kolibrios.org, ;; |
9 | ;; text encoder/decoder by Clevermouse. ;; |
9 | ;; text encoder/decoder by Clevermouse. ;; |
10 | ;; ;; |
10 | ;; ;; |
11 | ;; GNU GENERAL PUBLIC LICENSE ;; |
11 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; Version 2, June 1991 ;; |
12 | ;; Version 2, June 1991 ;; |
13 | ;; ;; |
13 | ;; ;; |
14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | 15 | ||
16 | version equ '0.1' |
16 | version equ '0.1' |
17 | 17 | ||
18 | ; connection status |
18 | ; connection status |
19 | STATUS_DISCONNECTED = 0 |
19 | STATUS_DISCONNECTED = 0 |
20 | STATUS_RESOLVING = 1 |
20 | STATUS_RESOLVING = 1 |
21 | STATUS_CONNECTING = 2 |
21 | STATUS_CONNECTING = 2 |
22 | STATUS_CONNECTED = 3 |
22 | STATUS_CONNECTED = 3 |
23 | 23 | ||
24 | ; window flags |
24 | ; window flags |
25 | FLAG_UPDATED = 1 shl 0 |
25 | FLAG_UPDATED = 1 shl 0 |
26 | FLAG_CLOSE = 1 shl 1 |
26 | FLAG_CLOSE = 1 shl 1 |
27 | FLAG_RECEIVING_NAMES = 1 shl 2 |
27 | FLAG_RECEIVING_NAMES = 1 shl 2 |
28 | 28 | ||
29 | ; window types |
29 | ; window types |
30 | WINDOWTYPE_SERVER = 0 |
30 | WINDOWTYPE_SERVER = 0 |
31 | WINDOWTYPE_CHANNEL = 1 |
31 | WINDOWTYPE_CHANNEL = 1 |
32 | WINDOWTYPE_CHAT = 2 |
32 | WINDOWTYPE_CHAT = 2 |
33 | WINDOWTYPE_LIST = 3 |
33 | WINDOWTYPE_LIST = 3 |
34 | WINDOWTYPE_DCC = 4 |
34 | WINDOWTYPE_DCC = 4 |
35 | 35 | ||
36 | ; supported encodings |
36 | ; supported encodings |
37 | CP866 = 0 |
37 | CP866 = 0 |
38 | CP1251 = 1 |
38 | CP1251 = 1 |
39 | UTF8 = 2 |
39 | UTF8 = 2 |
40 | 40 | ||
41 | ; settings |
41 | ; settings |
42 | USERCMD_MAX_SIZE = 400 |
42 | USERCMD_MAX_SIZE = 400 |
43 | 43 | ||
44 | WIN_MIN_X = 600 |
44 | WIN_MIN_X = 600 |
45 | WIN_MIN_Y = 165 |
45 | WIN_MIN_Y = 165 |
46 | 46 | ||
47 | TEXT_X = 5 |
47 | TEXT_X = 5 |
48 | TEXT_Y = 30 |
48 | TEXT_Y = 30 |
49 | 49 | ||
50 | TOP_Y = 25 |
50 | TOP_Y = 25 |
51 | 51 | ||
52 | MAX_WINDOWS = 20 |
52 | MAX_WINDOWS = 20 |
53 | MAX_USERS = 4096 |
53 | MAX_USERS = 4096 |
54 | 54 | ||
55 | MAX_NICK_LEN = 32 |
55 | MAX_NICK_LEN = 32 |
56 | MAX_REAL_LEN = 32 ; realname |
56 | MAX_REAL_LEN = 32 ; realname |
57 | MAX_SERVER_NAME = 256 |
57 | MAX_SERVER_NAME = 256 |
58 | 58 | ||
59 | MAX_CHANNEL_LEN = 40 |
59 | MAX_CHANNEL_LEN = 40 |
60 | MAX_CHANNELS = 37 |
60 | MAX_CHANNELS = 37 |
61 | 61 | ||
62 | MAX_COMMAND_LEN = 512 |
62 | MAX_COMMAND_LEN = 512 |
63 | 63 | ||
64 | TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp |
64 | TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp |
65 | 65 | ||
66 | MAX_WINDOWNAME_LEN = 256 |
66 | MAX_WINDOWNAME_LEN = 256 |
67 | 67 | ||
68 | WINDOW_BTN_START = 100 |
68 | WINDOW_BTN_START = 100 |
69 | 69 | ||
70 | SCROLLBAR_WIDTH = 12 |
70 | SCROLLBAR_WIDTH = 12 |
71 | 71 | ||
72 | USERLIST_X = 98 |
72 | USERLIST_X = 98 |
73 | 73 | ||
74 | 74 | ||
75 | format binary as "" |
75 | format binary as "" |
76 | 76 | ||
77 | use32 |
77 | use32 |
78 | 78 | ||
79 | org 0x0 |
79 | org 0x0 |
80 | 80 | ||
81 | db 'MENUET01' ; 8 byte id |
81 | db 'MENUET01' ; 8 byte id |
82 | dd 1 ; header version |
82 | dd 1 ; header version |
83 | dd START ; program start |
83 | dd START ; program start |
84 | dd I_END ; program image size |
84 | dd I_END ; program image size |
85 | dd IM_END+2048 ; required amount of memory |
85 | dd IM_END+2048 ; required amount of memory |
86 | dd IM_END+2048 |
86 | dd IM_END+2048 |
87 | dd param |
87 | dd param |
88 | dd path |
88 | dd path |
89 | 89 | ||
90 | include "../macros.inc" |
90 | include "../macros.inc" |
91 | include "../proc32.inc" |
91 | include "../proc32.inc" |
92 | include "../dll.inc" |
92 | include "../dll.inc" |
93 | include "../network.inc" |
93 | include "../network.inc" |
94 | include "../struct.inc" |
94 | include "../struct.inc" |
95 | include '../../../../../programs/develop/libraries/box_lib/trunk/box_lib.mac' |
95 | include '../develop/libraries/box_lib/trunk/box_lib.mac' |
96 | 96 | ||
97 | struct window |
97 | struct window |
98 | data_ptr dd ? ; zero if not used |
98 | data_ptr dd ? ; zero if not used |
99 | flags db ? |
99 | flags db ? |
100 | type db ? |
100 | type db ? |
101 | name rb MAX_WINDOWNAME_LEN |
101 | name rb MAX_WINDOWNAME_LEN |
102 | users dd ? |
102 | users dd ? |
103 | users_scroll dd ? |
103 | users_scroll dd ? |
104 | selected dd ? ; selected user, 0 if none selected |
104 | selected dd ? ; selected user, 0 if none selected |
105 | ends |
105 | ends |
106 | 106 | ||
107 | struct window_data |
107 | struct window_data |
108 | text rb 120*60 |
108 | text rb 120*60 |
109 | title rb 256 |
109 | title rb 256 |
110 | names rb MAX_NICK_LEN * MAX_USERS |
110 | names rb MAX_NICK_LEN * MAX_USERS |
111 | usertext rb 256 |
111 | usertext rb 256 |
112 | usertextlen dd ? |
112 | usertextlen dd ? |
113 | ends |
113 | ends |
114 | 114 | ||
115 | include "encodings.inc" |
115 | include "encodings.inc" |
116 | include "window.inc" ; also contains text print routines |
116 | include "window.inc" ; also contains text print routines |
117 | include "serverparser.inc" |
117 | include "serverparser.inc" |
118 | include "userparser.inc" |
118 | include "userparser.inc" |
119 | include "socket.inc" |
119 | include "socket.inc" |
120 | include "gui.inc" |
120 | include "gui.inc" |
121 | include "users.inc" |
121 | include "users.inc" |
122 | 122 | ||
123 | 123 | ||
124 | START: |
124 | START: |
125 | 125 | ||
126 | mcall 68, 11 ; init heap so we can allocate memory dynamically |
126 | mcall 68, 11 ; init heap so we can allocate memory dynamically |
127 | 127 | ||
128 | ; wanted events |
128 | ; wanted events |
129 | mcall 40, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK + EVM_MOUSE |
129 | mcall 40, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK + EVM_MOUSE |
130 | 130 | ||
131 | ; load libraries |
131 | ; load libraries |
132 | stdcall dll.Load, @IMPORT |
132 | stdcall dll.Load, @IMPORT |
133 | test eax, eax |
133 | test eax, eax |
134 | jnz exit |
134 | jnz exit |
135 | 135 | ||
136 | ; find path to main settings file (ircc.ini) |
136 | ; find path to main settings file (ircc.ini) |
137 | mov edi, path ; Calculate the length of zero-terminated string |
137 | mov edi, path ; Calculate the length of zero-terminated string |
138 | xor al, al |
138 | xor al, al |
139 | mov ecx, 1024 |
139 | mov ecx, 1024 |
140 | repne scasb |
140 | repne scasb |
141 | dec edi |
141 | dec edi |
142 | mov eax, '.ini' |
142 | mov eax, '.ini' |
143 | stosd |
143 | stosd |
144 | xor al, al |
144 | xor al, al |
145 | stosb |
145 | stosb |
146 | 146 | ||
147 | ; Fill the window buffer with zeros |
147 | ; Fill the window buffer with zeros |
148 | mov edi, windows |
148 | mov edi, windows |
149 | mov ecx, (sizeof.window*MAX_WINDOWS+3)/4 |
149 | mov ecx, (sizeof.window*MAX_WINDOWS+3)/4 |
150 | xor eax, eax |
150 | xor eax, eax |
151 | rep stosd |
151 | rep stosd |
152 | 152 | ||
153 | ; clear command area too |
153 | ; clear command area too |
154 | mov edi, servercommand |
154 | mov edi, servercommand |
155 | mov ecx, 600/4 |
155 | mov ecx, 600/4 |
156 | rep stosd |
156 | rep stosd |
157 | 157 | ||
158 | ; allocate window data block |
158 | ; allocate window data block |
159 | call window_create |
159 | call window_create |
160 | mov ebx, windows |
160 | mov ebx, windows |
161 | mov [ebx + window.data_ptr], eax |
161 | mov [ebx + window.data_ptr], eax |
162 | mov [ebx + window.flags], 0 |
162 | mov [ebx + window.flags], 0 |
163 | mov [ebx + window.type], WINDOWTYPE_SERVER |
163 | mov [ebx + window.type], WINDOWTYPE_SERVER |
164 | add eax, window_data.text |
164 | add eax, window_data.text |
165 | mov [text_start], eax |
165 | mov [text_start], eax |
166 | 166 | ||
167 | call window_refresh |
167 | call window_refresh |
168 | 168 | ||
169 | ; get system colors |
169 | ; get system colors |
170 | mcall 48, 3, colors, 40 |
170 | mcall 48, 3, colors, 40 |
171 | 171 | ||
172 | ; set edit box and scrollbar colors |
172 | ; set edit box and scrollbar colors |
173 | mov eax, [colors.work] |
173 | mov eax, [colors.work] |
174 | mov [scroll1.bg_color], eax |
174 | mov [scroll1.bg_color], eax |
175 | 175 | ||
176 | mov eax, [colors.work_button] |
176 | mov eax, [colors.work_button] |
177 | mov [scroll1.front_color], eax |
177 | mov [scroll1.front_color], eax |
178 | 178 | ||
179 | mov eax, [colors.work_text] |
179 | mov eax, [colors.work_text] |
180 | mov [scroll1.line_color], eax |
180 | mov [scroll1.line_color], eax |
181 | 181 | ||
182 | ; get settings from ini |
182 | ; get settings from ini |
183 | invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick |
183 | invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick |
184 | invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real |
184 | invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real |
185 | 185 | ||
186 | ; Welcome user |
186 | ; Welcome user |
187 | mov esi, str_welcome |
187 | mov esi, str_welcome |
188 | call print_text2 |
188 | call print_text2 |
189 | 189 | ||
190 | call draw_window ;;; FIXME (gui is not correctly drawn first time) |
190 | call draw_window ;;; FIXME (gui is not correctly drawn first time) |
191 | 191 | ||
192 | redraw: |
192 | redraw: |
193 | call draw_window |
193 | call draw_window |
194 | 194 | ||
195 | still: |
195 | still: |
196 | 196 | ||
197 | ; wait here for event |
197 | ; wait here for event |
198 | mcall 10 |
198 | mcall 10 |
199 | 199 | ||
200 | dec eax |
200 | dec eax |
201 | jz redraw |
201 | jz redraw |
202 | 202 | ||
203 | dec eax |
203 | dec eax |
204 | jz main_window_key |
204 | jz main_window_key |
205 | 205 | ||
206 | dec eax |
206 | dec eax |
207 | jz button |
207 | jz button |
208 | 208 | ||
209 | cmp al, 3 |
209 | cmp al, 3 |
210 | je mouse |
210 | je mouse |
211 | 211 | ||
212 | call process_network_event |
212 | call process_network_event |
213 | 213 | ||
214 | mov edx, [window_open] |
214 | mov edx, [window_open] |
215 | test [edx + window.flags], FLAG_UPDATED |
215 | test [edx + window.flags], FLAG_UPDATED |
216 | jz .no_update |
216 | jz .no_update |
217 | and [edx + window.flags], not FLAG_UPDATED |
217 | and [edx + window.flags], not FLAG_UPDATED |
218 | mov edx, [edx + window.data_ptr] |
218 | mov edx, [edx + window.data_ptr] |
219 | add edx, window_data.text |
219 | add edx, window_data.text |
220 | call draw_channel_text |
220 | call draw_channel_text |
221 | .no_update: |
221 | .no_update: |
222 | call print_channel_list |
222 | call print_channel_list |
223 | 223 | ||
224 | jmp still |
224 | jmp still |
225 | 225 | ||
226 | button: |
226 | button: |
227 | 227 | ||
228 | mcall 17 ; get id |
228 | mcall 17 ; get id |
229 | shr eax, 8 |
229 | shr eax, 8 |
230 | 230 | ||
231 | cmp ax, 1 ; close program |
231 | cmp ax, 1 ; close program |
232 | je exit |
232 | je exit |
233 | 233 | ||
234 | cmp ax, 50 |
234 | cmp ax, 50 |
235 | jne @f |
235 | jne @f |
236 | 236 | ||
237 | mcall 37, 1 ; Get mouse position |
237 | mcall 37, 1 ; Get mouse position |
238 | sub ax, TEXT_Y |
238 | sub ax, TEXT_Y |
239 | mov bl, 10 |
239 | mov bl, 10 |
240 | div bl |
240 | div bl |
241 | and eax, 0x000000ff |
241 | and eax, 0x000000ff |
242 | inc eax |
242 | inc eax |
243 | add eax, [scroll1.position] |
243 | add eax, [scroll1.position] |
244 | mov ebx, [window_open] |
244 | mov ebx, [window_open] |
245 | mov [ebx + window.selected], eax |
245 | mov [ebx + window.selected], eax |
246 | 246 | ||
247 | call print_channel_list |
247 | call print_channel_list |
248 | 248 | ||
249 | jmp still |
249 | jmp still |
250 | 250 | ||
251 | @@: |
251 | @@: |
252 | sub ax, WINDOW_BTN_START |
252 | sub ax, WINDOW_BTN_START |
253 | jb exit |
253 | jb exit |
254 | 254 | ||
255 | cmp ax, MAX_WINDOWS |
255 | cmp ax, MAX_WINDOWS |
256 | ja exit |
256 | ja exit |
257 | 257 | ||
258 | mov dx, sizeof.window |
258 | mov dx, sizeof.window |
259 | mul dx |
259 | mul dx |
260 | shl edx, 16 |
260 | shl edx, 16 |
261 | mov dx, ax |
261 | mov dx, ax |
262 | add edx, windows |
262 | add edx, windows |
263 | cmp [edx + window.data_ptr], 0 |
263 | cmp [edx + window.data_ptr], 0 |
264 | je exit |
264 | je exit |
265 | mov [window_open], edx |
265 | mov [window_open], edx |
266 | call window_refresh |
266 | call window_refresh |
267 | call draw_window |
267 | call draw_window |
268 | 268 | ||
269 | jmp still |
269 | jmp still |
270 | exit: |
270 | exit: |
271 | mcall -1 |
271 | mcall -1 |
272 | 272 | ||
273 | 273 | ||
274 | 274 | ||
275 | main_window_key: |
275 | main_window_key: |
276 | 276 | ||
277 | mcall 2 |
277 | mcall 2 |
278 | 278 | ||
279 | push dword edit1 |
279 | push dword edit1 |
280 | call [edit_box_key] |
280 | call [edit_box_key] |
281 | 281 | ||
282 | cmp ah, 13 ; enter |
282 | cmp ah, 13 ; enter |
283 | jne no_send2 |
283 | jne no_send2 |
284 | 284 | ||
285 | call user_parser |
285 | call user_parser |
286 | 286 | ||
287 | mov [edit1.size], 0 |
287 | mov [edit1.size], 0 |
288 | mov [edit1.pos], 0 |
288 | mov [edit1.pos], 0 |
289 | 289 | ||
290 | push dword edit1 |
290 | push dword edit1 |
291 | call [edit_box_draw] |
291 | call [edit_box_draw] |
292 | 292 | ||
293 | mov edx, [window_open] |
293 | mov edx, [window_open] |
294 | mov edx, [edx + window.data_ptr] |
294 | mov edx, [edx + window.data_ptr] |
295 | add edx, window_data.text |
295 | add edx, window_data.text |
296 | call draw_channel_text |
296 | call draw_channel_text |
297 | 297 | ||
298 | jmp still |
298 | jmp still |
299 | no_send2: |
299 | no_send2: |
300 | 300 | ||
301 | jmp still |
301 | jmp still |
302 | 302 | ||
303 | mouse: |
303 | mouse: |
304 | push dword edit1 |
304 | push dword edit1 |
305 | call [edit_box_mouse] |
305 | call [edit_box_mouse] |
306 | 306 | ||
307 | ; TODO: check if scrollbar is active |
307 | ; TODO: check if scrollbar is active |
308 | push [scroll1.position] |
308 | push [scroll1.position] |
309 | push dword scroll1 |
309 | push dword scroll1 |
310 | call [scrollbar_v_mouse] |
310 | call [scrollbar_v_mouse] |
311 | pop eax |
311 | pop eax |
312 | cmp eax, [scroll1.position] ; did the scrollbar move? |
312 | cmp eax, [scroll1.position] ; did the scrollbar move? |
313 | je @f |
313 | je @f |
314 | call print_channel_list |
314 | call print_channel_list |
315 | @@: |
315 | @@: |
316 | 316 | ||
317 | jmp still |
317 | jmp still |
318 | 318 | ||
319 | 319 | ||
320 | ; DATA AREA |
320 | ; DATA AREA |
321 | 321 | ||
322 | encoding_text: |
322 | encoding_text: |
323 | db 'CP866 ' |
323 | db 'CP866 ' |
324 | db 'CP1251' |
324 | db 'CP1251' |
325 | db 'UTF-8 ' |
325 | db 'UTF-8 ' |
326 | encoding_text_len = 6 |
326 | encoding_text_len = 6 |
327 | 327 | ||
328 | action_header db '*** ', 0 |
328 | action_header db '*** ', 0 |
329 | action_header_short db '* ', 0 |
329 | action_header_short db '* ', 0 |
330 | ctcp_header db '-> [',0 |
330 | ctcp_header db '-> [',0 |
331 | ctcp_version db '] VERSION',10,0 |
331 | ctcp_version db '] VERSION',10,0 |
332 | ctcp_ping db '] PING',10,0 |
332 | ctcp_ping db '] PING',10,0 |
333 | ctcp_time db '] TIME',10,0 |
333 | ctcp_time db '] TIME',10,0 |
334 | has_left_channel db ' has left ', 0 |
334 | has_left_channel db ' has left ', 0 |
335 | joins_channel db ' has joined ', 0 |
335 | joins_channel db ' has joined ', 0 |
336 | is_now_known_as db ' is now known as ', 0 |
336 | is_now_known_as db ' is now known as ', 0 |
337 | has_quit_irc db ' has quit IRC', 10, 0 |
337 | has_quit_irc db ' has quit IRC', 10, 0 |
338 | sets_mode db ' sets mode ', 0 |
338 | sets_mode db ' sets mode ', 0 |
339 | kicked db ' is kicked from ', 0 |
339 | kicked db ' is kicked from ', 0 |
340 | str_talking db 'Now talking in ',0 |
340 | str_talking db 'Now talking in ',0 |
341 | str_topic db 'Topic is ',0 |
341 | str_topic db 'Topic is ',0 |
342 | str_setby db 'Set by ',0 |
342 | str_setby db 'Set by ',0 |
343 | 343 | ||
344 | str_version db 'VERSION ' |
344 | str_version db 'VERSION ' |
345 | str_programname db 'KolibriOS IRC client ', version, 0 |
345 | str_programname db 'KolibriOS IRC client ', version, 0 |
346 | 346 | ||
347 | str_user db 'user', 0 |
347 | str_user db 'user', 0 |
348 | str_nick db 'nick', 0 |
348 | str_nick db 'nick', 0 |
349 | str_real db 'realname', 0 |
349 | str_real db 'realname', 0 |
350 | str_email db 'email', 0 |
350 | str_email db 'email', 0 |
351 | 351 | ||
352 | default_nick db 'kolibri_user', 0 |
352 | default_nick db 'kolibri_user', 0 |
353 | default_real db 'Kolibri User', 0 |
353 | default_real db 'Kolibri User', 0 |
354 | 354 | ||
355 | str_welcome db 10 |
355 | str_welcome db 10 |
356 | db ' ______________________ __ __ __',10 |
356 | db ' ______________________ __ __ __',10 |
357 | db '| \______ \_ ___ \ ____ | | |__| ____ _____/ |_',10 |
357 | db '| \______ \_ ___ \ ____ | | |__| ____ _____/ |_',10 |
358 | db '| || _/ \ \/ _/ ___\| | | |/ __ \ / \ __\',10 |
358 | db '| || _/ \ \/ _/ ___\| | | |/ __ \ / \ __\',10 |
359 | db '| || | \ \____ \ \___| |_| \ ___/| | \ |',10 |
359 | db '| || | \ \____ \ \___| |_| \ ___/| | \ |',10 |
360 | db '|___||____|_ /\______ / \___ >____/__|\___ >___| /__|',10 |
360 | db '|___||____|_ /\______ / \___ >____/__|\___ >___| /__|',10 |
361 | db ' \/ \/ \/ \/ \/',10 |
361 | db ' \/ \/ \/ \/ \/',10 |
362 | db 10 |
362 | db 10 |
363 | db 'Welcome to IRC client ',version,' for KolibriOS',10 |
363 | db 'Welcome to IRC client ',version,' for KolibriOS',10 |
364 | db 10 |
364 | db 10 |
365 | db 'Type /help for help',10,0 |
365 | db 'Type /help for help',10,0 |
366 | 366 | ||
367 | str_nickchange db 'Nickname is now ',0 |
367 | str_nickchange db 'Nickname is now ',0 |
368 | str_realchange db 'Real name is now ',0 |
368 | str_realchange db 'Real name is now ',0 |
369 | str_dotnewline db '.',10, 0 |
369 | str_dotnewline db '.',10, 0 |
370 | str_newline db 10, 0 |
370 | str_newline db 10, 0 |
371 | str_connecting db 10,'* Connecting to ',0 |
371 | str_connecting db 10,'* Connecting to ',0 |
372 | str_help db 10,'following commands are available:',10 |
372 | str_help db 10,'following commands are available:',10 |
373 | db 10 |
373 | db 10 |
374 | db '/nick |
374 | db '/nick |
375 | db '/real |
375 | db '/real |
376 | db '/server : connect to server ',10 |
376 | db '/server : connect to server ',10 |
377 | db '/code |
377 | db '/code |
378 | 378 | ||
379 | str_1 db ' -',0 |
379 | str_1 db ' -',0 |
380 | str_2 db '- ',0 |
380 | str_2 db '- ',0 |
381 | 381 | ||
382 | str_sockerr db 'Socket Error',10,0 |
382 | str_sockerr db 'Socket Error',10,0 |
383 | str_dnserr db 'Unable to resolve hostname.',10,0 |
383 | str_dnserr db 'Unable to resolve hostname.',10,0 |
384 | str_refused db 'Connection refused',10,0 |
384 | str_refused db 'Connection refused',10,0 |
385 | 385 | ||
386 | sockaddr1: |
386 | sockaddr1: |
387 | dw AF_INET4 |
387 | dw AF_INET4 |
388 | .port dw 0x0b1a ; 6667 |
388 | .port dw 0x0b1a ; 6667 |
389 | .ip dd 0 |
389 | .ip dd 0 |
390 | rb 10 |
390 | rb 10 |
391 | 391 | ||
392 | 392 | ||
393 | status dd STATUS_DISCONNECTED |
393 | status dd STATUS_DISCONNECTED |
394 | 394 | ||
395 | text_start dd ? ; pointer to current textbox data |
395 | text_start dd ? ; pointer to current textbox data |
396 | irc_data dd 0x0 ; encoder |
396 | irc_data dd 0x0 ; encoder |
397 | textbox_width dd 80 ; in characters, not pixels ;) |
397 | textbox_width dd 80 ; in characters, not pixels ;) |
398 | pos dd 66 * 11 ; encoder |
398 | pos dd 66 * 11 ; encoder |
399 | 399 | ||
400 | window_open dd windows |
400 | window_open dd windows |
401 | window_print dd windows |
401 | window_print dd windows |
402 | 402 | ||
403 | scroll dd 1 |
403 | scroll dd 1 |
404 | dd 12 |
404 | dd 12 |
405 | 405 | ||
406 | align 4 |
406 | align 4 |
407 | @IMPORT: |
407 | @IMPORT: |
408 | 408 | ||
409 | library network, 'network.obj',\ |
409 | library network, 'network.obj',\ |
410 | libini, 'libini.obj',\ |
410 | libini, 'libini.obj',\ |
411 | boxlib, 'box_lib.obj' |
411 | boxlib, 'box_lib.obj' |
412 | 412 | ||
413 | import network,\ |
413 | import network,\ |
414 | getaddrinfo, 'getaddrinfo',\ |
414 | getaddrinfo, 'getaddrinfo',\ |
415 | freeaddrinfo, 'freeaddrinfo',\ |
415 | freeaddrinfo, 'freeaddrinfo',\ |
416 | inet_ntoa, 'inet_ntoa' |
416 | inet_ntoa, 'inet_ntoa' |
417 | 417 | ||
418 | import libini,\ |
418 | import libini,\ |
419 | ini.get_str, 'ini_get_str',\ |
419 | ini.get_str, 'ini_get_str',\ |
420 | ini.get_int, 'ini_get_int' |
420 | ini.get_int, 'ini_get_int' |
421 | 421 | ||
422 | import boxlib,\ |
422 | import boxlib,\ |
423 | edit_box_draw ,'edit_box' ,\ |
423 | edit_box_draw ,'edit_box' ,\ |
424 | edit_box_key ,'edit_box_key' ,\ |
424 | edit_box_key ,'edit_box_key' ,\ |
425 | edit_box_mouse ,'edit_box_mouse' ,\ |
425 | edit_box_mouse ,'edit_box_mouse' ,\ |
426 | scrollbar_v_draw ,'scrollbar_v_draw' ,\ |
426 | scrollbar_v_draw ,'scrollbar_v_draw' ,\ |
427 | scrollbar_v_mouse,'scrollbar_v_mouse' |
427 | scrollbar_v_mouse,'scrollbar_v_mouse' |
428 | 428 | ||
429 | 429 | ||
430 | usercommand db '/server chat.freenode.net', 0 |
430 | usercommand db '/server chat.freenode.net', 0 |
431 | rb MAX_COMMAND_LEN |
431 | rb MAX_COMMAND_LEN |
432 | 432 | ||
433 | I_END: |
433 | I_END: |
434 | 434 | ||
435 | ; width, left, top |
435 | ; width, left, top |
436 | edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25 |
436 | edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_focus, 25, 25 |
437 | ; xsize, xpos, ysize, ypos, max, cur, pos, bgcol, frcol, linecol |
437 | ; xsize, xpos, ysize, ypos, max, cur, pos, bgcol, frcol, linecol |
438 | scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
438 | scroll1 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
439 | scroll2 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
439 | scroll2 scrollbar SCROLLBAR_WIDTH, 300, 150, TOP_Y, 10, 100, 0, 0, 0, 0, 0, 1 |
440 | 440 | ||
441 | main_PID dd ? ; identifier of main thread |
441 | main_PID dd ? ; identifier of main thread |
442 | utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence |
442 | utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence |
443 | utf8_char dd ? ; first bits of current UTF8 character |
443 | utf8_char dd ? ; first bits of current UTF8 character |
444 | gai_reqdata rb 32 ; buffer for getaddrinfo_start/process |
444 | gai_reqdata rb 32 ; buffer for getaddrinfo_start/process |
445 | ip_list dd ? ; will be filled as pointer to addrinfo list |
445 | ip_list dd ? ; will be filled as pointer to addrinfo list |
446 | packetbuf rb 1024 ; buffer for packets to server |
446 | packetbuf rb 1024 ; buffer for packets to server |
447 | path rb 1024 |
447 | path rb 1024 |
448 | param rb 1024 |
448 | param rb 1024 |
449 | 449 | ||
450 | socketnum dd ? |
450 | socketnum dd ? |
451 | 451 | ||
452 | servercommand rb 600 |
452 | servercommand rb 600 |
453 | 453 | ||
454 | thread_info rb 1024 |
454 | thread_info rb 1024 |
455 | xsize dd ? |
455 | xsize dd ? |
456 | ysize dd ? |
456 | ysize dd ? |
457 | 457 | ||
458 | colors system_colors |
458 | colors system_colors |
459 | 459 | ||
460 | irc_server_name rb MAX_SERVER_NAME |
460 | irc_server_name rb MAX_SERVER_NAME |
461 | 461 | ||
462 | user_nick rb MAX_NICK_LEN |
462 | user_nick rb MAX_NICK_LEN |
463 | user_real_name rb MAX_REAL_LEN |
463 | user_real_name rb MAX_REAL_LEN |
464 | 464 | ||
465 | windows rb MAX_WINDOWS*sizeof.window |
465 | windows rb MAX_WINDOWS*sizeof.window |
466 | 466 | ||
467 | mouse_dd dd ? |
467 | mouse_dd dd ? |
468 | 468 | ||
469 | IM_END: |
469 | IM_END: |