Subversion Repositories Kolibri OS

Rev

Rev 6026 | Rev 7300 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6026 Rev 6027
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2016. 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
;;   Written by hidnplayr@kolibrios.org                            ;;
6
;;   Written by hidnplayr@kolibrios.org                            ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;         GNU GENERAL PUBLIC LICENSE                              ;;
8
;;         GNU GENERAL PUBLIC LICENSE                              ;;
9
;;          Version 2, June 1991                                   ;;
9
;;          Version 2, June 1991                                   ;;
10
;;                                                                 ;;
10
;;                                                                 ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
 
12
 
13
 
13
 
14
server_parser:
14
server_parser:
15
 
15
 
16
        mov     esi, servercommand
16
        mov     esi, servercommand
17
 
17
 
18
        cmp     byte [esi], ':'
18
        cmp     byte [esi], ':'
19
        jne     .parse
19
        jne     .parse
20
 
20
 
21
  .spaceloop:
21
  .spaceloop:
22
        lodsb
22
        lodsb
23
        test    al, al
23
        test    al, al
24
        jz      .fail
24
        jz      .fail
25
        cmp     al, ' '
25
        cmp     al, ' '
26
        jne     .spaceloop
26
        jne     .spaceloop
27
 
27
 
28
  .parse:
28
  .parse:
29
        mov     eax, [esi]
29
        mov     eax, [esi]
30
        or      eax, 0x20202020
30
        or      eax, 0x20202020
31
        mov     edi, server_commands
31
        mov     edi, server_commands
32
        mov     ecx, server_commands.number
32
        mov     ecx, server_commands.number
33
 
33
 
34
  .loop:
34
  .loop:
35
        scasd
35
        scasd
36
        je      .got_cmd
36
        je      .got_cmd
37
        add     edi, 4
37
        add     edi, 4
38
        dec     ecx
38
        dec     ecx
39
        jnz     .loop
39
        jnz     .loop
40
 
40
 
41
  .fail:
41
  .fail:
42
        ret
42
        ret
43
 
43
 
44
  .got_cmd:
44
  .got_cmd:
45
        jmp     dword[edi]
45
        jmp     dword[edi]
46
 
46
 
47
 
47
 
48
server_commands:
48
server_commands:
49
 
49
 
50
        dd      '001 ', cmd_justprint
50
        dd      '001 ', cmd_welcome
51
        dd      '002 ', cmd_justprint
51
        dd      '002 ', cmd_justprint
52
        dd      '003 ', cmd_justprint
52
        dd      '003 ', cmd_justprint
53
        dd      '004 ', cmd_justprint
53
        dd      '004 ', cmd_justprint
54
        dd      '005 ', cmd_justprint
54
        dd      '005 ', cmd_justprint
55
 
55
 
56
        dd      '250 ', cmd_justprint
56
        dd      '250 ', cmd_justprint
57
        dd      '251 ', cmd_justprint
57
        dd      '251 ', cmd_justprint
58
        dd      '252 ', cmd_justprint
58
        dd      '252 ', cmd_justprint
59
        dd      '253 ', cmd_justprint
59
        dd      '253 ', cmd_justprint
60
        dd      '254 ', cmd_justprint
60
        dd      '254 ', cmd_justprint
61
        dd      '255 ', cmd_justprint
61
        dd      '255 ', cmd_justprint
62
 
62
 
63
        dd      '265 ', cmd_justprint
63
        dd      '265 ', cmd_justprint
64
        dd      '266 ', cmd_justprint
64
        dd      '266 ', cmd_justprint
65
 
65
 
66
        dd      '311 ', cmd_justprint   ; RPL_WHOISUSER
66
        dd      '311 ', cmd_justprint   ; RPL_WHOISUSER
67
        dd      '312 ', cmd_justprint   ; RPL_WHOISSERVER
67
        dd      '312 ', cmd_justprint   ; RPL_WHOISSERVER
68
        dd      '318 ', cmd_justprint   ; RPL_ENDOFWHOIS
68
        dd      '318 ', cmd_justprint   ; RPL_ENDOFWHOIS
69
        dd      '322 ', cmd_322         ; RPL_LIST
69
        dd      '322 ', cmd_322         ; RPL_LIST
70
        dd      '323 ', cmd_323         ; RPL_LISTEND
70
        dd      '323 ', cmd_323         ; RPL_LISTEND
71
        dd      '324 ', cmd_justprint   ; RPL_CHANNELMODEIS
71
        dd      '324 ', cmd_justprint   ; RPL_CHANNELMODEIS
72
        dd      '328 ', cmd_justprint   ; RPL_CHANNEL_URL
72
        dd      '328 ', cmd_justprint   ; RPL_CHANNEL_URL
73
        dd      '329 ', cmd_justprint   ; RPL_CREATIONTIME
73
        dd      '329 ', cmd_justprint   ; RPL_CREATIONTIME
74
        dd      '330 ', cmd_justprint
74
        dd      '330 ', cmd_justprint
75
        dd      '332 ', cmd_topic       ; topic
75
        dd      '332 ', cmd_topic       ; topic
76
        dd      '333 ', cmd_333         ; nickname and time of topic
76
        dd      '333 ', cmd_333         ; nickname and time of topic
77
        dd      '353 ', cmd_353         ; name reply
77
        dd      '353 ', cmd_353         ; name reply
78
        dd      '366 ', cmd_366         ; end of names list
78
        dd      '366 ', cmd_366         ; end of names list
79
        dd      '372 ', cmd_justprint   ; motd
79
        dd      '372 ', cmd_justprint   ; motd
80
        dd      '375 ', cmd_justprint   ; start of motd
80
        dd      '375 ', cmd_justprint   ; start of motd
81
        dd      '376 ', cmd_justprint   ; end of motd
81
        dd      '376 ', cmd_justprint   ; end of motd
82
        dd      '421 ', cmd_justprint   ; unknown command
82
        dd      '421 ', cmd_justprint   ; unknown command
-
 
83
        dd      '432 ', cmd_justprint   ; erroneous nickname
83
        dd      '433 ', cmd_justprint   ; nickname already in use
84
        dd      '433 ', cmd_justprint   ; nickname already in use
-
 
85
        dd      '436 ', cmd_justprint   ; nickname collision
84
 
86
 
85
        dd      'join', cmd_join
87
        dd      'join', cmd_join
86
        dd      'kick', cmd_kick
88
        dd      'kick', cmd_kick
87
        dd      'mode', cmd_mode
89
        dd      'mode', cmd_mode
88
        dd      'nick', cmd_nick
90
        dd      'nick', cmd_nick
89
        dd      'part', cmd_part
91
        dd      'part', cmd_part
90
        dd      'ping', cmd_ping
92
        dd      'ping', cmd_ping
91
        dd      'priv', cmd_privmsg
93
        dd      'priv', cmd_privmsg
92
        dd      'quit', cmd_quit
94
        dd      'quit', cmd_quit
93
        dd      'noti', cmd_notice
95
        dd      'noti', cmd_notice
94
 
96
 
95
        .number = ($ - server_commands) / 8
97
        .number = ($ - server_commands) / 8
96
 
98
 
97
 
99
 
98
align 4
100
align 4
99
compare_to_nick:
101
compare_to_nick:
100
 
102
 
101
        push    esi
103
        push    esi
102
        mov     ecx, MAX_NICK_LEN
104
        mov     ecx, MAX_NICK_LEN
103
        mov     esi, user_nick
105
        mov     esi, user_nick
104
  .loop:
106
  .loop:
105
        lodsb
107
        lodsb
106
        cmp     al, ' '
108
        cmp     al, ' '
107
        jbe     .done
109
        jbe     .done
108
        test    al, al
110
        test    al, al
109
        jz      .done
111
        jz      .done
110
        cmp     al, 'a'
112
        cmp     al, 'a'
111
        jb      .ok
113
        jb      .ok
112
        cmp     al, 'z'
114
        cmp     al, 'z'
113
        ja      .ok
115
        ja      .ok
114
        sub     al, 0x20
116
        sub     al, 0x20
115
  .ok:
117
  .ok:
116
 
118
 
117
        mov     bl, byte[edi]
119
        mov     bl, byte[edi]
118
        cmp     bl, 'a'
120
        cmp     bl, 'a'
119
        jb      .ok2
121
        jb      .ok2
120
        cmp     bl, 'z'
122
        cmp     bl, 'z'
121
        ja      .ok2
123
        ja      .ok2
122
        sub     bl, 0x20
124
        sub     bl, 0x20
123
  .ok2:
125
  .ok2:
124
        cmp     bl, al
126
        cmp     bl, al
125
        jne     .not_equal
127
        jne     .not_equal
126
        inc     edi
128
        inc     edi
127
        dec     ecx
129
        dec     ecx
128
        jnz     .loop
130
        jnz     .loop
129
 
131
 
130
  .done:
132
  .done:
131
        xor     eax, eax
133
        xor     eax, eax
132
        pop     esi
134
        pop     esi
133
        ret
135
        ret
134
 
136
 
135
  .not_equal:
137
  .not_equal:
136
        or      eax, -1
138
        or      eax, -1
137
        pop     esi
139
        pop     esi
138
        ret
140
        ret
139
 
141
 
140
 
142
 
141
 
143
 
142
align 4
144
align 4
143
skip_parameter:
145
skip_parameter:
144
 
146
 
145
; First: skip the parameter (scan untill space or colon)
147
; First: skip the parameter (scan untill space or colon)
146
  .part1:
148
  .part1:
147
        lodsb
149
        lodsb
148
        cmp     al, ' '
150
        cmp     al, ' '
149
        je      .part2
151
        je      .part2
150
        cmp     al, ':'
152
        cmp     al, ':'
151
        jne     .part1
153
        jne     .part1
152
 
154
 
153
; Skip all trailing spaces
155
; Skip all trailing spaces
154
  .part3:
156
  .part3:
155
        lodsb
157
        lodsb
156
        cmp     al, ' '
158
        cmp     al, ' '
157
        je      .part3
159
        je      .part3
158
        dec     esi
160
        dec     esi
159
        ret
161
        ret
160
 
162
 
161
; Now, skip all trailing spaces and first semicolon
163
; Now, skip all trailing spaces and first semicolon
162
  .part2:
164
  .part2:
163
        lodsb
165
        lodsb
164
        cmp     al, ' '
166
        cmp     al, ' '
165
        je      .part2
167
        je      .part2
166
        cmp     al, ':'
168
        cmp     al, ':'
167
        je      .part3
169
        je      .part3
168
        dec     esi
170
        dec     esi
169
        ret
171
        ret
170
 
172
 
171
 
173
 
-
 
174
 
-
 
175
cmd_welcome:
172
 
176
 
173
 
177
        mov     [status], STATUS_LOGGED_IN
174
 
178
 
175
cmd_justprint:
179
cmd_justprint:
176
 
180
 
177
        add     esi, 4
181
        add     esi, 4
178
        call    skip_parameter          ; our nickname
182
        call    skip_parameter          ; our nickname
179
 
183
 
180
        call    print_asciiz
184
        call    print_asciiz
181
 
185
 
182
        mov     al, 10
186
        mov     al, 10
183
        call    print_char
187
        call    print_char
184
 
188
 
185
        ret
189
        ret
186
 
190
 
-
 
191
 
187
 
192
 
188
cmd_notice:
193
cmd_notice:
189
 
194
 
190
        if TIMESTAMP
195
        if TIMESTAMP
191
        call    print_timestamp
196
        call    print_timestamp
192
        end if
197
        end if
193
 
198
 
194
        cmp     byte[servercommand], ':'
199
        cmp     byte[servercommand], ':'
195
        jne     .gogogo
200
        jne     .gogogo
196
 
201
 
197
        mov     byte [esi-1], 0
202
        mov     byte [esi-1], 0
198
        push    esi
203
        push    esi
199
        mov     esi, str_1
204
        mov     esi, str_1
200
        call    print_asciiz
205
        call    print_asciiz
201
        mov     esi, servercommand+1
206
        mov     esi, servercommand+1
202
        mov     bl, '!'
207
        mov     bl, '!'
203
        call    print_string
208
        call    print_string
204
        mov     esi, str_2
209
        mov     esi, str_2
205
        call    print_asciiz
210
        call    print_asciiz
206
        pop     esi
211
        pop     esi
207
 
212
 
208
  .gogogo:
213
  .gogogo:
209
        add     esi, 6
214
        add     esi, 6
210
        call    skip_parameter
215
        call    skip_parameter
211
        call    skip_parameter
216
        call    skip_parameter
212
        call    print_asciiz
217
        call    print_asciiz
213
 
218
 
214
        mov     al, 10
219
        mov     al, 10
215
        call    print_char
220
        call    print_char
216
 
221
 
217
        ret
222
        ret
218
 
223
 
219
 
224
 
220
 
225
 
221
cmd_ping:
226
cmd_ping:
222
 
227
 
223
; Just change PING to PONG
228
; Just change PING to PONG
224
        mov     dword[esi], 'PONG'
229
        mov     dword[esi], 'PONG'
225
 
230
 
226
; Find the end of the command
231
; Find the end of the command
227
        lea     edi, [esi + 5]
232
        lea     edi, [esi + 5]
228
        xor     al, al
233
        xor     al, al
229
        repne   scasb
234
        repne   scasb
230
 
235
 
231
; Now send it back
236
; Now send it back
232
        mov     edx, esi
237
        mov     edx, esi
233
        mov     esi, edi
238
        mov     esi, edi
234
        mov     word [esi], 0x0d0a
239
        mov     word [esi], 0x0d0a
235
        inc     esi
240
        inc     esi
236
        inc     esi
241
        inc     esi
237
        sub     esi, edx
242
        sub     esi, edx
238
        mcall   send, [socketnum], , , 0
243
        mcall   send, [socketnum], , , 0
239
 
244
 
240
        ret
245
        ret
241
 
246
 
242
 
247
 
243
 
248
 
244
cmd_privmsg:
249
cmd_privmsg:
245
 
250
 
246
        mov     eax, dword[esi+4]
251
        mov     eax, dword[esi+4]
247
        or      eax, 0x20202020
252
        or      eax, 0x20202020
248
        cmp     eax, 'msg '
253
        cmp     eax, 'msg '
249
        jne     .fail
254
        jne     .fail
250
        add     esi, 8          ; skip 'PRIVMSG '
255
        add     esi, 8          ; skip 'PRIVMSG '
251
 
256
 
252
        mov     edi, esi
257
        mov     edi, esi
253
        call    compare_to_nick
258
        call    compare_to_nick
254
        jne     .channel
259
        jne     .channel
255
 
260
 
256
; private chat message
261
; private chat message
257
        push    esi
262
        push    esi
258
        mov     esi, servercommand+1
263
        mov     esi, servercommand+1
259
        call    window_open
264
        call    window_open
260
        test    ebx, ebx
265
        test    ebx, ebx
261
        jz      .fail2
266
        jz      .fail2
262
        pop     esi
267
        pop     esi
263
        call    skip_parameter  ; our own nickname
268
        call    skip_parameter  ; our own nickname
264
        jmp     .print
269
        jmp     .print
265
 
270
 
266
  .channel:
271
  .channel:
267
        call    window_open
272
        call    window_open
268
        test    ebx, ebx
273
        test    ebx, ebx
269
        jz      .fail
274
        jz      .fail
270
 
275
 
271
  .print:
276
  .print:
272
        cmp     byte[esi], 1    ; Client to Client protocol?
277
        cmp     byte[esi], 1    ; Client to Client protocol?
273
        je      cmd_ctcp
278
        je      cmd_ctcp
274
 
279
 
275
        if TIMESTAMP
280
        if TIMESTAMP
276
        call    print_timestamp
281
        call    print_timestamp
277
        end if
282
        end if
278
 
283
 
279
        push    esi
284
        push    esi
280
        mov     al, '<'
285
        mov     al, '<'
281
        call    print_char
286
        call    print_char
282
 
287
 
283
        mov     esi, servercommand+1
288
        mov     esi, servercommand+1
284
        mov     bl, '!'
289
        mov     bl, '!'
285
        call    print_string
290
        call    print_string
286
 
291
 
287
        mov     al, '>'
292
        mov     al, '>'
288
        call    print_char
293
        call    print_char
289
 
294
 
290
        mov     al, ' '
295
        mov     al, ' '
291
        call    print_char
296
        call    print_char
292
 
297
 
293
        pop     esi
298
        pop     esi
294
        call    print_asciiz
299
        call    print_asciiz
295
 
300
 
296
        mov     al, 10
301
        mov     al, 10
297
        call    print_char
302
        call    print_char
298
 
303
 
299
        ret
304
        ret
300
 
305
 
301
  .fail2:
306
  .fail2:
302
        pop     esi
307
        pop     esi
303
  .fail:
308
  .fail:
304
        ret
309
        ret
305
 
310
 
306
 
311
 
307
 
312
 
308
 
313
 
309
cmd_ctcp:
314
cmd_ctcp:
310
 
315
 
311
        inc     esi
316
        inc     esi
312
        mov     eax, dword[esi]
317
        mov     eax, dword[esi]
313
        or      eax, 0x20202020
318
        or      eax, 0x20202020
314
 
319
 
315
        cmp     eax, 'vers'
320
        cmp     eax, 'vers'
316
        je      .version
321
        je      .version
317
        cmp     eax, 'time'
322
        cmp     eax, 'time'
318
        je      .time
323
        je      .time
319
        cmp     eax, 'ping'
324
        cmp     eax, 'ping'
320
        je      .ping
325
        je      .ping
321
        cmp     eax, 'acti'
326
        cmp     eax, 'acti'
322
        je      .action
327
        je      .action
323
        cmp     eax, 'dcc '    ; TODO
328
        cmp     eax, 'dcc '    ; TODO
324
        je      cmd_dcc
329
        je      cmd_dcc
325
 
330
 
326
; Unknown CTCP command: TODO: just print to window??
331
; Unknown CTCP command: TODO: just print to window??
327
 
332
 
328
  .fail:
333
  .fail:
329
 
334
 
330
        ret
335
        ret
331
 
336
 
332
  .time:
337
  .time:
333
        mov     byte[esi+4], ' '
338
        mov     byte[esi+4], ' '
334
        lea     edi, [esi+5]
339
        lea     edi, [esi+5]
335
 
340
 
336
        ; TODO: add system date (fn 29) in human readable format
341
        ; TODO: add system date (fn 29) in human readable format
337
 
342
 
338
        mcall   3                       ; get system time
343
        mcall   3                       ; get system time
339
 
344
 
340
        mov     ecx, 3
345
        mov     ecx, 3
341
  .timeloop:
346
  .timeloop:
342
        mov     bl, al
347
        mov     bl, al
343
        shr     al, 4
348
        shr     al, 4
344
        add     al, '0'
349
        add     al, '0'
345
        stosb
350
        stosb
346
 
351
 
347
        mov     al, bl
352
        mov     al, bl
348
        and     al, 0x0f
353
        and     al, 0x0f
349
        add     al, '0'
354
        add     al, '0'
350
        stosb
355
        stosb
351
 
356
 
352
        dec     ecx
357
        dec     ecx
353
        jz      .timedone
358
        jz      .timedone
354
 
359
 
355
        mov     al, ':'
360
        mov     al, ':'
356
        stosb
361
        stosb
357
        shr     eax, 8
362
        shr     eax, 8
358
        jmp     .timeloop
363
        jmp     .timeloop
359
 
364
 
360
  .timedone:
365
  .timedone:
361
        xor     al, al
366
        xor     al, al
362
        stosb
367
        stosb
363
        call    ctcp_reply
368
        call    ctcp_reply
364
 
369
 
365
        if TIMESTAMP
370
        if TIMESTAMP
366
        call    print_timestamp
371
        call    print_timestamp
367
        end if
372
        end if
368
 
373
 
369
        mov     esi, ctcp_header
374
        mov     esi, ctcp_header
370
        call    print_asciiz
375
        call    print_asciiz
371
 
376
 
372
        mov     esi, servercommand+1
377
        mov     esi, servercommand+1
373
        call    print_asciiz
378
        call    print_asciiz
374
 
379
 
375
        mov     esi, ctcp_time
380
        mov     esi, ctcp_time
376
        call    print_asciiz
381
        call    print_asciiz
377
 
382
 
378
        ret
383
        ret
379
 
384
 
380
  .version:
385
  .version:
381
        mov     esi, str_version
386
        mov     esi, str_version
382
        call    ctcp_reply
387
        call    ctcp_reply
383
 
388
 
384
        if TIMESTAMP
389
        if TIMESTAMP
385
        call    print_timestamp
390
        call    print_timestamp
386
        end if
391
        end if
387
 
392
 
388
        mov     esi, ctcp_header
393
        mov     esi, ctcp_header
389
        call    print_asciiz
394
        call    print_asciiz
390
 
395
 
391
        mov     esi, servercommand+1
396
        mov     esi, servercommand+1
392
        call    print_asciiz
397
        call    print_asciiz
393
 
398
 
394
        mov     esi, ctcp_version
399
        mov     esi, ctcp_version
395
        call    print_asciiz
400
        call    print_asciiz
396
 
401
 
397
        ret
402
        ret
398
 
403
 
399
  .ping:
404
  .ping:
400
        call    ctcp_reply
405
        call    ctcp_reply
401
 
406
 
402
        if TIMESTAMP
407
        if TIMESTAMP
403
        call    print_timestamp
408
        call    print_timestamp
404
        end if
409
        end if
405
 
410
 
406
        mov     esi, ctcp_header
411
        mov     esi, ctcp_header
407
        call    print_asciiz
412
        call    print_asciiz
408
 
413
 
409
        mov     esi, servercommand+1
414
        mov     esi, servercommand+1
410
        call    print_asciiz
415
        call    print_asciiz
411
 
416
 
412
        mov     esi, ctcp_ping
417
        mov     esi, ctcp_ping
413
        call    print_asciiz
418
        call    print_asciiz
414
 
419
 
415
        ret
420
        ret
416
 
421
 
417
  .action:
422
  .action:
418
        add     esi, 7
423
        add     esi, 7
419
        push    esi
424
        push    esi
420
 
425
 
421
        if TIMESTAMP
426
        if TIMESTAMP
422
        call    print_timestamp
427
        call    print_timestamp
423
        end if
428
        end if
424
 
429
 
425
        mov     esi, action_header
430
        mov     esi, action_header
426
        call    print_asciiz
431
        call    print_asciiz
427
 
432
 
428
        mov     esi, servercommand+1    ; print nickname
433
        mov     esi, servercommand+1    ; print nickname
429
        mov     bl, '!'
434
        mov     bl, '!'
430
        call    print_string
435
        call    print_string
431
 
436
 
432
        mov     al, ' '
437
        mov     al, ' '
433
        call    print_char
438
        call    print_char
434
 
439
 
435
        pop     esi
440
        pop     esi
436
        call    print_asciiz
441
        call    print_asciiz
437
 
442
 
438
        mov     al, 10
443
        mov     al, 10
439
        call    print_char
444
        call    print_char
440
 
445
 
441
        ret
446
        ret
442
 
447
 
443
 
448
 
444
cmd_dcc:
449
cmd_dcc:
445
        add     esi, 4
450
        add     esi, 4
446
        mov     eax, dword[esi]
451
        mov     eax, dword[esi]
447
        or      eax, 0x202020
452
        or      eax, 0x202020
448
 
453
 
449
        cmp     eax, 'send'
454
        cmp     eax, 'send'
450
        je      .send
455
        je      .send
451
 
456
 
452
        ret
457
        ret
453
 
458
 
454
  .send:
459
  .send:
455
        call    window_open
460
        call    window_open
456
        test    ebx, ebx
461
        test    ebx, ebx
457
        jz      .fail
462
        jz      .fail
458
        mov     [ebx + window.type], WINDOWTYPE_DCC
463
        mov     [ebx + window.type], WINDOWTYPE_DCC
459
 
464
 
460
  .fail:
465
  .fail:
461
 
466
 
462
        ret
467
        ret
463
 
468
 
464
 
469
 
465
 
470
 
466
ctcp_reply:
471
ctcp_reply:
467
 
472
 
468
        push    esi
473
        push    esi
469
        mov     dword [usercommand], 'NOTI'
474
        mov     dword[user_command], 'NOTI'
470
        mov     dword [usercommand+4], 'CE  '
475
        mov     dword[user_command+4], 'CE  '
471
 
476
 
472
        mov     esi, servercommand+1
477
        mov     esi, servercommand+1
473
        mov     edi, usercommand+7
478
        mov     edi, user_command+7
474
  .nickloop:
479
  .nickloop:
475
        lodsb
480
        lodsb
476
        cmp     al, '!'
481
        cmp     al, '!'
477
        je      .done
482
        je      .done
478
        cmp     al, ' '
483
        cmp     al, ' '
479
        je      .done
484
        je      .done
480
        test    al, al
485
        test    al, al
481
        je      .fail
486
        je      .fail
482
        stosb
487
        stosb
483
        jmp     .nickloop
488
        jmp     .nickloop
484
  .done:
489
  .done:
485
        mov     byte [esi-1], 0
490
        mov     byte [esi-1], 0
486
        mov     ax, ' :'
491
        mov     ax, ' :'
487
        stosw
492
        stosw
488
        mov     al, 1
493
        mov     al, 1
489
        stosb
494
        stosb
490
 
495
 
491
        pop     esi
496
        pop     esi
492
  .replyloop:
497
  .replyloop:
493
        lodsb
498
        lodsb
494
        cmp     al, 1
499
        cmp     al, 1
495
        jbe     .done2
500
        jbe     .done2
496
        stosb
501
        stosb
497
        jmp     .replyloop
502
        jmp     .replyloop
498
  .done2:
503
  .done2:
499
 
504
 
500
        mov     al, 1
505
        mov     al, 1
501
        stosb
506
        stosb
502
        mov     ax, 0x0a0d
507
        mov     ax, 0x0a0d
503
        stosw
508
        stosw
504
 
509
 
505
        lea     esi, [edi - usercommand]
510
        lea     esi, [edi - user_command]
506
        mcall   send, [socketnum], usercommand, , 0
511
        mcall   send, [socketnum], user_command, , 0
507
  .fail:
512
  .fail:
508
        ret
513
        ret
509
 
514
 
510
 
515
 
511
 
516
 
512
cmd_part:
517
cmd_part:
513
 
518
 
514
        cmp     byte [esi+4], ' '
519
        cmp     byte [esi+4], ' '
515
        jne     .fail
520
        jne     .fail
516
        add     esi, 5  ; skip 'PART '
521
        add     esi, 5  ; skip 'PART '
517
 
522
 
518
; Is it me who parted?
523
; Is it me who parted?
519
        mov     edi, servercommand+1
524
        mov     edi, servercommand+1
520
        call    compare_to_nick
525
        call    compare_to_nick
521
        jne     .not_me
526
        jne     .not_me
522
 
527
 
523
; yes, close the window (if its open)
528
; yes, close the window (if its open)
524
        call    window_find
529
        call    window_find
525
        test    ebx, ebx
530
        test    ebx, ebx
526
        jz      @f
531
        jz      @f
527
        call    window_close
532
        call    window_close
528
  @@:
533
  @@:
529
  .fail:
534
  .fail:
530
 
535
 
531
        ret
536
        ret
532
 
537
 
533
 
538
 
534
; somebody else parted, just print message
539
; somebody else parted, just print message
535
  .not_me:
540
  .not_me:
536
        push    esi
541
        push    esi
537
        call    window_open
542
        call    window_open
538
        test    ebx, ebx
543
        test    ebx, ebx
539
        jz      .fail2
544
        jz      .fail2
540
 
545
 
541
        if TIMESTAMP
546
        if TIMESTAMP
542
        call    print_timestamp
547
        call    print_timestamp
543
        end if
548
        end if
544
 
549
 
545
        mov     esi, part_header
550
        mov     esi, part_header
546
        call    print_asciiz
551
        call    print_asciiz
547
 
552
 
548
        mov     esi, servercommand+1
553
        mov     esi, servercommand+1
549
        mov     bl, '!'
554
        mov     bl, '!'
550
        call    print_string
555
        call    print_string
551
 
556
 
552
        mov     esi, has_left_channel
557
        mov     esi, has_left_channel
553
        call    print_asciiz
558
        call    print_asciiz
554
 
559
 
555
        pop     esi
560
        pop     esi
556
        call    print_asciiz
561
        call    print_asciiz
557
 
562
 
558
        mov     al, 10
563
        mov     al, 10
559
        call    print_char
564
        call    print_char
560
 
565
 
561
        mov     ebx, [window_print]
566
        mov     ebx, [window_print]
562
        mov     esi, servercommand+1
567
        mov     esi, servercommand+1
563
        call    user_remove
568
        call    user_remove
564
 
569
 
565
        ret
570
        ret
566
 
571
 
567
  .fail2:
572
  .fail2:
568
        pop     esi
573
        pop     esi
569
 
574
 
570
        ret
575
        ret
571
 
576
 
572
 
577
 
573
 
578
 
574
cmd_join:
579
cmd_join:
575
 
580
 
576
        cmp     byte[esi+4], ' '
581
        cmp     byte[esi+4], ' '
577
        jne     .fail
582
        jne     .fail
578
        add     esi, 5  ; skip 'JOIN '
583
        add     esi, 5  ; skip 'JOIN '
579
 
584
 
580
; did we join a channel?
585
; did we join a channel?
581
        mov     edi, servercommand+1
586
        mov     edi, servercommand+1
582
        call    compare_to_nick
587
        call    compare_to_nick
583
        jne     .not_me
588
        jne     .not_me
584
 
589
 
585
        push    esi
590
        push    esi
586
        call    window_open
591
        call    window_open
587
        test    ebx, ebx
592
        test    ebx, ebx
588
        jz      .fail
593
        jz      .fail
589
        mov     [ebx + window.type], WINDOWTYPE_CHANNEL
594
        mov     [ebx + window.type], WINDOWTYPE_CHANNEL
590
        mov     [window_active], ebx
595
        mov     [window_active], ebx
591
 
596
 
592
        if TIMESTAMP
597
        if TIMESTAMP
593
        call    print_timestamp
598
        call    print_timestamp
594
        end if
599
        end if
595
 
600
 
596
        mov     esi, join_header
601
        mov     esi, join_header
597
        call    print_asciiz
602
        call    print_asciiz
598
 
603
 
599
        mov     esi, str_talking
604
        mov     esi, str_talking
600
        call    print_asciiz
605
        call    print_asciiz
601
 
606
 
602
        pop     esi
607
        pop     esi
603
        mov     bl, ' '
608
        mov     bl, ' '
604
        call    print_string
609
        call    print_string
605
 
610
 
606
        mov     al, 10
611
        mov     al, 10
607
        call    print_char
612
        call    print_char
608
 
613
 
609
        call    draw_window
614
        call    draw_window
610
 
615
 
611
        ret
616
        ret
612
 
617
 
613
  .not_me:
618
  .not_me:
614
        push    esi
619
        push    esi
615
        call    window_open
620
        call    window_open
616
        test    ebx, ebx
621
        test    ebx, ebx
617
        jz      .fail
622
        jz      .fail
618
 
623
 
619
        if TIMESTAMP
624
        if TIMESTAMP
620
        call    print_timestamp
625
        call    print_timestamp
621
        end if
626
        end if
622
 
627
 
623
        mov     esi, join_header
628
        mov     esi, join_header
624
        call    print_asciiz
629
        call    print_asciiz
625
 
630
 
626
        mov     esi, servercommand+1
631
        mov     esi, servercommand+1
627
        mov     bl, '!'
632
        mov     bl, '!'
628
        call    print_string
633
        call    print_string
629
 
634
 
630
        mov     esi, joins_channel
635
        mov     esi, joins_channel
631
        call    print_asciiz
636
        call    print_asciiz
632
 
637
 
633
        pop     esi
638
        pop     esi
634
        call    print_asciiz
639
        call    print_asciiz
635
 
640
 
636
        mov     al, 10
641
        mov     al, 10
637
        call    print_char
642
        call    print_char
638
 
643
 
639
        mov     ebx, [window_print]
644
        mov     ebx, [window_print]
640
        mov     esi, servercommand+1
645
        mov     esi, servercommand+1
641
        call    user_add
646
        call    user_add
642
 
647
 
643
        ret
648
        ret
644
 
649
 
645
  .fail:
650
  .fail:
646
        pop     esi
651
        pop     esi
647
        ret
652
        ret
648
 
653
 
649
 
654
 
650
 
655
 
651
 
656
 
652
cmd_nick:
657
cmd_nick:
653
 
658
 
654
        cmp     byte[esi+4], ' '
659
        cmp     byte[esi+4], ' '
655
        jne     .fail
660
        jne     .fail
656
        add     esi, 5          ; skip 'NICK '
661
        add     esi, 5          ; skip 'NICK '
657
        cmp     byte[esi], ':'
662
        cmp     byte[esi], ':'
658
        jne     @f
663
        jne     @f
659
        inc     esi
664
        inc     esi
660
  @@:
665
  @@:
661
 
666
 
662
; Is it me who changed nick?
667
; Is it me who changed nick?
663
        push    esi
668
        push    esi
664
        mov     edi, servercommand+1
669
        mov     edi, servercommand+1
665
        call    compare_to_nick
670
        call    compare_to_nick
666
        jne     .not_me
671
        jne     .not_me
667
 
672
 
668
; Yup, update user_nick
673
; Yup, update user_nick
669
        mov     ecx, MAX_NICK_LEN-1
674
        mov     ecx, MAX_NICK_LEN-1
670
        mov     esi, [esp]
675
        mov     esi, [esp]
671
        mov     edi, user_nick
676
        mov     edi, user_nick
672
  @@:
677
  @@:
673
        lodsb
678
        lodsb
674
        test    al, al
679
        test    al, al
675
        jz      @f
680
        jz      @f
676
        cmp     al, ' '
681
        cmp     al, ' '
677
        je      @f
682
        je      @f
678
        cmp     al, 10
683
        cmp     al, 10
679
        je      @f
684
        je      @f
680
        cmp     al, 13
685
        cmp     al, 13
681
        je      @f
686
        je      @f
682
        cmp     al, ':'
687
        cmp     al, ':'
683
        je      @r
688
        je      @r
684
        stosb
689
        stosb
685
        dec     ecx
690
        dec     ecx
686
        jnz     @r
691
        jnz     @r
687
  @@:
692
  @@:
688
        xor     al, al
693
        xor     al, al
689
        stosb
694
        stosb
690
 
695
 
691
; Print a message on the server window
696
; Print a message on the server window
692
        mov     [window_print], windows
697
        mov     [window_print], windows
693
 
698
 
694
        mov     esi, str_nickchange
699
        mov     esi, str_nickchange
695
        call    print_asciiz
700
        call    print_asciiz
696
 
701
 
697
        mov     esi, user_nick
702
        mov     esi, user_nick
698
        call    print_asciiz
703
        call    print_asciiz
699
 
704
 
700
        mov     al, 10
705
        mov     al, 10
701
        call    print_char
706
        call    print_char
702
 
707
 
703
  .not_me:
708
  .not_me:
704
 
709
 
705
; Update in userlist
710
; Update in userlist
706
        mov     ebx, windows
711
        mov     ebx, windows
707
        mov     ecx, MAX_WINDOWS
712
        mov     ecx, MAX_WINDOWS
708
  .window_loop:
713
  .window_loop:
709
        push    ecx ebx
714
        push    ecx ebx
710
        cmp     [ebx + window.type], WINDOWTYPE_CHANNEL
715
        cmp     [ebx + window.type], WINDOWTYPE_CHANNEL
711
        jne     .next_window
716
        jne     .next_window
712
 
717
 
713
        mov     esi, servercommand+1
718
        mov     esi, servercommand+1
714
        call    user_remove
719
        call    user_remove
715
        test    edi, edi
720
        test    edi, edi
716
        jz      .next_window
721
        jz      .next_window
717
 
722
 
718
        mov     esi, [esp + 8]
723
        mov     esi, [esp + 8]
719
        call    user_add
724
        call    user_add
720
 
725
 
721
; And print a notification in the channel
726
; And print a notification in the channel
722
        mov     [window_print], ebx
727
        mov     [window_print], ebx
723
 
728
 
724
        if TIMESTAMP
729
        if TIMESTAMP
725
        call    print_timestamp
730
        call    print_timestamp
726
        end if
731
        end if
727
 
732
 
728
        mov     esi, nick_header
733
        mov     esi, nick_header
729
        call    print_asciiz
734
        call    print_asciiz
730
 
735
 
731
        mov     esi, servercommand+1
736
        mov     esi, servercommand+1
732
        mov     bl, '!'
737
        mov     bl, '!'
733
        call    print_string
738
        call    print_string
734
 
739
 
735
        mov     esi, is_now_known_as
740
        mov     esi, is_now_known_as
736
        call    print_asciiz
741
        call    print_asciiz
737
 
742
 
738
        mov     esi, [esp + 8]
743
        mov     esi, [esp + 8]
739
        call    print_asciiz
744
        call    print_asciiz
740
 
745
 
741
        mov     al, 10
746
        mov     al, 10
742
        call    print_char
747
        call    print_char
743
 
748
 
744
; Now do this for all open windows
749
; Now do this for all open windows
745
  .next_window:
750
  .next_window:
746
        pop     ebx ecx
751
        pop     ebx ecx
747
        add     ebx, sizeof.window
752
        add     ebx, sizeof.window
748
        dec     ecx
753
        dec     ecx
749
        jnz     .window_loop
754
        jnz     .window_loop
750
 
755
 
751
        pop     esi
756
        pop     esi
752
 
757
 
753
  .fail:
758
  .fail:
754
 
759
 
755
        ret
760
        ret
756
 
761
 
757
 
762
 
758
 
763
 
759
 
764
 
760
cmd_kick:
765
cmd_kick:
761
 
766
 
762
        cmp     byte [esi+4], ' '
767
        cmp     byte [esi+4], ' '
763
        jne     .fail
768
        jne     .fail
764
        add     esi, 5  ; skip 'KICK '
769
        add     esi, 5  ; skip 'KICK '
765
 
770
 
766
; TODO: Is it me who got kicked?
771
; TODO: Is it me who got kicked?
767
; if so, mark channel as disconnected
772
; if so, mark channel as disconnected
768
 
773
 
769
  .not_me:
774
  .not_me:
770
; find the channel user has been kicked from
775
; find the channel user has been kicked from
771
        push    esi
776
        push    esi
772
        call    window_open
777
        call    window_open
773
        test    ebx, ebx
778
        test    ebx, ebx
774
        jz      .fail
779
        jz      .fail
775
        push    esi
780
        push    esi
776
 
781
 
777
        if TIMESTAMP
782
        if TIMESTAMP
778
        call    print_timestamp
783
        call    print_timestamp
779
        end if
784
        end if
780
 
785
 
781
        mov     esi, kick_header
786
        mov     esi, kick_header
782
        call    print_asciiz
787
        call    print_asciiz
783
 
788
 
784
        pop     esi
789
        pop     esi
785
        mov     bl, ' '
790
        mov     bl, ' '
786
        call    print_string
791
        call    print_string
787
 
792
 
788
        mov     esi, str_kicked
793
        mov     esi, str_kicked
789
        call    print_asciiz
794
        call    print_asciiz
790
 
795
 
791
        pop     esi
796
        pop     esi
792
        mov     bl, ' '
797
        mov     bl, ' '
793
        call    print_string
798
        call    print_string
794
 
799
 
795
        mov     esi, str_by
800
        mov     esi, str_by
796
        call    print_asciiz
801
        call    print_asciiz
797
 
802
 
798
        mov     esi, servercommand+1
803
        mov     esi, servercommand+1
799
        mov     bl, '!'
804
        mov     bl, '!'
800
        call    print_string
805
        call    print_string
801
 
806
 
802
        mov     al, 10
807
        mov     al, 10
803
        call    print_char
808
        call    print_char
804
 
809
 
805
        mov     ebx, [window_print]
810
        mov     ebx, [window_print]
806
        mov     esi, servercommand+1
811
        mov     esi, servercommand+1
807
        call    user_remove
812
        call    user_remove
808
 
813
 
809
        ret
814
        ret
810
 
815
 
811
  .fail:
816
  .fail:
812
        pop     esi
817
        pop     esi
813
 
818
 
814
        ret
819
        ret
815
 
820
 
816
 
821
 
817
 
822
 
818
cmd_quit:
823
cmd_quit:
819
 
824
 
820
        cmp     byte [esi+4], ' '
825
        cmp     byte [esi+4], ' '
821
        jne     .fail
826
        jne     .fail
822
 
827
 
823
        mov     ebx, windows
828
        mov     ebx, windows
824
        mov     ecx, MAX_WINDOWS
829
        mov     ecx, MAX_WINDOWS
825
 
830
 
826
  .window_loop:
831
  .window_loop:
827
        push    ecx
832
        push    ecx
828
        cmp     [ebx + window.type], WINDOWTYPE_CHANNEL
833
        cmp     [ebx + window.type], WINDOWTYPE_CHANNEL
829
        jne     .next_window
834
        jne     .next_window
830
 
835
 
831
        mov     esi, servercommand+1
836
        mov     esi, servercommand+1
832
        call    user_remove
837
        call    user_remove
833
        test    edi, edi
838
        test    edi, edi
834
        jz      .next_window
839
        jz      .next_window
835
 
840
 
836
        push    ebx
841
        push    ebx
837
        mov     [window_print], ebx
842
        mov     [window_print], ebx
838
 
843
 
839
        if TIMESTAMP
844
        if TIMESTAMP
840
        call    print_timestamp
845
        call    print_timestamp
841
        end if
846
        end if
842
 
847
 
843
        mov     esi, quit_header
848
        mov     esi, quit_header
844
        call    print_asciiz
849
        call    print_asciiz
845
 
850
 
846
        mov     esi, servercommand+1
851
        mov     esi, servercommand+1
847
        mov     bl, '!'
852
        mov     bl, '!'
848
        call    print_string
853
        call    print_string
849
 
854
 
850
        mov     esi, has_quit_irc
855
        mov     esi, has_quit_irc
851
        call    print_asciiz
856
        call    print_asciiz
852
 
857
 
853
; TODO: check if quit message was given, and print it to the window
858
; TODO: check if quit message was given, and print it to the window
854
        pop     ebx
859
        pop     ebx
855
  .next_window:
860
  .next_window:
856
        pop     ecx
861
        pop     ecx
857
        add     ebx, sizeof.window
862
        add     ebx, sizeof.window
858
        dec     ecx
863
        dec     ecx
859
        jnz     .window_loop
864
        jnz     .window_loop
860
 
865
 
861
  .fail:
866
  .fail:
862
 
867
 
863
 
868
 
864
        ret
869
        ret
865
 
870
 
866
 
871
 
867
 
872
 
868
cmd_mode:
873
cmd_mode:
869
 
874
 
870
        cmp     byte [esi+4], ' '
875
        cmp     byte [esi+4], ' '
871
        jne     .fail
876
        jne     .fail
872
        add     esi, 5  ; skip 'MODE '
877
        add     esi, 5  ; skip 'MODE '
873
        push    esi
878
        push    esi
874
        call    window_find
879
        call    window_find
875
        test    ebx, ebx
880
        test    ebx, ebx
876
        jz      .user
881
        jz      .user
877
        mov     [esp], esi
882
        mov     [esp], esi
878
        mov     [window_print], ebx
883
        mov     [window_print], ebx
879
 
884
 
880
        if TIMESTAMP
885
        if TIMESTAMP
881
        call    print_timestamp
886
        call    print_timestamp
882
        end if
887
        end if
883
 
888
 
884
        mov     esi, mode_header
889
        mov     esi, mode_header
885
        call    print_asciiz
890
        call    print_asciiz
886
 
891
 
887
        mov     esi, servercommand+1
892
        mov     esi, servercommand+1
888
        mov     bl, '!'
893
        mov     bl, '!'
889
        call    print_string
894
        call    print_string
890
 
895
 
891
        mov     esi, sets_mode
896
        mov     esi, sets_mode
892
        call    print_asciiz
897
        call    print_asciiz
893
 
898
 
894
        pop     esi
899
        pop     esi
895
        call    print_asciiz
900
        call    print_asciiz
896
 
901
 
897
        mov     al, 10
902
        mov     al, 10
898
        call    print_char
903
        call    print_char
899
 
904
 
900
; TODO: keep track of user modes in username list
905
; TODO: keep track of user modes in username list
901
 
906
 
902
  .fail:
907
  .fail:
903
        ret
908
        ret
904
 
909
 
905
 
910
 
906
  .user:
911
  .user:
907
        if TIMESTAMP
912
        if TIMESTAMP
908
        call    print_timestamp
913
        call    print_timestamp
909
        end if
914
        end if
910
 
915
 
911
        mov     esi, mode_header
916
        mov     esi, mode_header
912
        call    print_asciiz
917
        call    print_asciiz
913
 
918
 
914
        mov     esi, [esp]
919
        mov     esi, [esp]
915
        mov     bl, ' '
920
        mov     bl, ' '
916
        call    print_string
921
        call    print_string
917
 
922
 
918
        mov     esi, sets_mode
923
        mov     esi, sets_mode
919
        call    print_asciiz
924
        call    print_asciiz
920
 
925
 
921
        pop     esi
926
        pop     esi
922
        call    skip_parameter
927
        call    skip_parameter
923
        call    print_asciiz
928
        call    print_asciiz
924
 
929
 
925
        mov     al, 10
930
        mov     al, 10
926
        call    print_char
931
        call    print_char
927
 
932
 
928
        ret
933
        ret
929
 
934
 
930
 
935
 
931
cmd_353:                ; channel usernames reply
936
cmd_353:                ; channel usernames reply
932
 
937
 
933
        add     esi, 4  ; skip '353 '
938
        add     esi, 4  ; skip '353 '
934
        call    skip_parameter
939
        call    skip_parameter
935
        inc     esi     ; channel type '*', '=' or '@'
940
        inc     esi     ; channel type '*', '=' or '@'
936
        inc     esi     ; ' '
941
        inc     esi     ; ' '
937
        call    window_open
942
        call    window_open
938
        test    ebx, ebx
943
        test    ebx, ebx
939
        jz      .fail
944
        jz      .fail
940
 
945
 
941
; now find window ptr and check if this is the first 353 message
946
; now find window ptr and check if this is the first 353 message
942
        mov     ebx, [window_print]
947
        mov     ebx, [window_print]
943
        test    [ebx + window.flags], FLAG_RECEIVING_NAMES
948
        test    [ebx + window.flags], FLAG_RECEIVING_NAMES
944
        jnz     .add
949
        jnz     .add
945
 
950
 
946
        or      [ebx + window.flags], FLAG_RECEIVING_NAMES
951
        or      [ebx + window.flags], FLAG_RECEIVING_NAMES
947
;        mov     [ebx + window.users], 0
952
;        mov     [ebx + window.users], 0
948
        ; TODO: remove all users?
953
        ; TODO: remove all users?
949
 
954
 
950
  .add:
955
  .add:
951
        push    esi
956
        push    esi
952
        call    user_add
957
        call    user_add
953
        pop     esi
958
        pop     esi
954
 
959
 
955
  .namesloop:
960
  .namesloop:
956
        lodsb
961
        lodsb
957
        test    al, al
962
        test    al, al
958
        jz      .done
963
        jz      .done
959
        cmp     al, ' '                 ; names list is separated with spaces
964
        cmp     al, ' '                 ; names list is separated with spaces
960
        jne     .namesloop
965
        jne     .namesloop
961
        jmp     .add
966
        jmp     .add
962
 
967
 
963
  .done:
968
  .done:
964
        call    draw_user_list
969
        call    draw_user_list
965
  .fail:
970
  .fail:
966
 
971
 
967
        ret
972
        ret
968
 
973
 
969
 
974
 
970
 
975
 
971
 
976
 
972
 
977
 
973
cmd_366:        ; channel usernames end
978
cmd_366:        ; channel usernames end
974
 
979
 
975
        add     esi, 4          ; skip '366 '
980
        add     esi, 4          ; skip '366 '
976
        call    skip_parameter
981
        call    skip_parameter
977
        call    window_open
982
        call    window_open
978
        test    ebx, ebx
983
        test    ebx, ebx
979
        jz      .fail
984
        jz      .fail
980
        and     [ebx + window.flags], not FLAG_RECEIVING_NAMES
985
        and     [ebx + window.flags], not FLAG_RECEIVING_NAMES
981
  .fail:
986
  .fail:
982
 
987
 
983
        ret
988
        ret
984
 
989
 
985
 
990
 
986
 
991
 
987
 
992
 
988
cmd_topic:
993
cmd_topic:
989
 
994
 
990
        add     esi, 4          ; skip '332 '
995
        add     esi, 4          ; skip '332 '
991
        call    skip_parameter
996
        call    skip_parameter
992
        call    window_open
997
        call    window_open
993
        test    ebx, ebx
998
        test    ebx, ebx
994
        jz      .fail
999
        jz      .fail
995
 
1000
 
996
        if TIMESTAMP
1001
        if TIMESTAMP
997
        call    print_timestamp
1002
        call    print_timestamp
998
        end if
1003
        end if
999
 
1004
 
1000
        push    esi
1005
        push    esi
1001
        mov     esi, topic_header
1006
        mov     esi, topic_header
1002
        call    print_asciiz
1007
        call    print_asciiz
1003
 
1008
 
1004
        mov     esi, str_topic
1009
        mov     esi, str_topic
1005
        call    print_asciiz
1010
        call    print_asciiz
1006
 
1011
 
1007
        pop     esi
1012
        pop     esi
1008
        call    print_asciiz
1013
        call    print_asciiz
1009
 
1014
 
1010
        mov     esi, str_topic_end
1015
        mov     esi, str_topic_end
1011
        call    print_asciiz
1016
        call    print_asciiz
1012
 
1017
 
1013
  .fail:
1018
  .fail:
1014
 
1019
 
1015
        ret
1020
        ret
1016
 
1021
 
1017
 
1022
 
1018
cmd_333:
1023
cmd_333:
1019
 
1024
 
1020
        add     esi, 4          ; skip '333 '
1025
        add     esi, 4          ; skip '333 '
1021
        call    skip_parameter
1026
        call    skip_parameter
1022
        call    window_open
1027
        call    window_open
1023
        test    ebx, ebx
1028
        test    ebx, ebx
1024
        jz      .fail
1029
        jz      .fail
1025
 
1030
 
1026
        if TIMESTAMP
1031
        if TIMESTAMP
1027
        call    print_timestamp
1032
        call    print_timestamp
1028
        end if
1033
        end if
1029
 
1034
 
1030
        push    esi
1035
        push    esi
1031
        mov     esi, topic_header
1036
        mov     esi, topic_header
1032
        call    print_asciiz
1037
        call    print_asciiz
1033
 
1038
 
1034
        mov     esi, str_setby
1039
        mov     esi, str_setby
1035
        call    print_asciiz
1040
        call    print_asciiz
1036
 
1041
 
1037
        pop     esi
1042
        pop     esi
1038
        mov     bl, '!'
1043
        mov     bl, '!'
1039
        call    print_string
1044
        call    print_string
1040
 
1045
 
1041
        mov     al, 10
1046
        mov     al, 10
1042
        call    print_char
1047
        call    print_char
1043
 
1048
 
1044
  .fail:
1049
  .fail:
1045
 
1050
 
1046
        ret
1051
        ret
1047
 
1052
 
1048
 
1053
 
1049
 
1054
 
1050
cmd_322:        ; LIST
1055
cmd_322:        ; LIST
1051
 
1056
 
1052
        add     esi, 4
1057
        add     esi, 4
1053
        call    skip_parameter
1058
        call    skip_parameter
1054
 
1059
 
1055
        push    esi
1060
        push    esi
1056
        mov     esi, str_list
1061
        mov     esi, str_list
1057
        call    window_open
1062
        call    window_open
1058
        test    ebx, ebx
1063
        test    ebx, ebx
1059
        jz      .fail
1064
        jz      .fail
1060
 
1065
 
1061
        mov     [window_active], ebx
1066
        mov     [window_active], ebx
1062
        call    draw_window_tabs
1067
        call    draw_window_tabs
1063
        pop     esi
1068
        pop     esi
1064
        call    print_asciiz
1069
        call    print_asciiz
1065
        mov     al, 10
1070
        mov     al, 10
1066
        call    print_char
1071
        call    print_char
1067
 
1072
 
1068
        ret
1073
        ret
1069
 
1074
 
1070
  .fail:
1075
  .fail:
1071
        pop     esi
1076
        pop     esi
1072
 
1077
 
1073
        ret
1078
        ret
1074
 
1079
 
1075
cmd_323:        ; LIST END
1080
cmd_323:        ; LIST END
1076
 
1081
 
1077
        ret
1082
        ret
1078
>
1083
>