Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                   ;;
1188 clevermous 3
;;    IRC CLIENT for KolibriOS                       ;;
31 halyavin 4
;;                                                   ;;
5
;;    License: GPL / See file COPYING for details    ;;
6
;;    Copyright 2004 (c) Ville Turjanmaa             ;;
1188 clevermous 7
;;    Copyright 2009 (c) CleverMouse                 ;;
31 halyavin 8
;;                                                   ;;
1188 clevermous 9
;;    Compile with FASM for Kolibri                  ;;
31 halyavin 10
;;                                                   ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
 
1188 clevermous 13
version equ '0.6'
31 halyavin 14
 
485 heavyiron 15
 
16
;__DEBUG__ equ 1
17
;__DEBUG_LEVEL__ equ 1
18
 
31 halyavin 19
use32
20
 
195 heavyiron 21
		org	0x0
31 halyavin 22
 
195 heavyiron 23
		db	'MENUET01'		; 8 byte id
24
		dd	0x01			; required os
25
		dd	START			; program start
1188 clevermous 26
		dd	initialized_size	; program image size
195 heavyiron 27
		dd	0x100000		; required amount of memory
28
		dd	0x100000
29
		dd	0,0
30
 
1188 clevermous 31
include "../../../macros.inc"
32
include "../../../proc32.inc"
33
include "../../../develop/libraries/network/network.inc"
34
include "dll.inc"
485 heavyiron 35
;include "fdo.inc"
36
include "eth.inc"
1726 ataualpa 37
include "lang.inc"
31 halyavin 38
 
1188 clevermous 39
; connection statuses
40
STATUS_DISCONNECTED = 0 ; disconnected
41
STATUS_RESOLVING    = 1 ; resolving server name
42
STATUS_CONNECTING   = 2 ; connecting to server
43
STATUS_CONNECTED    = 3 ; connected
44
; where to display status
45
STATUS_X = 25 + 22*6
46
STATUS_Y = 183 + 7*12
31 halyavin 47
 
1188 clevermous 48
; supported encodings
49
CP866 = 0
50
CP1251 = 1
51
UTF8 = 2
52
; where to display encoding
53
ENCODING_X = 25 + 15*6
54
ENCODING_Y = 183 + 3*12
55
 
1729 hidnplayr 56
def_server_name db	'chat.freenode.net',0		  ; default server name
1188 clevermous 57
 
556 heavyiron 58
user_nick	dd	12				  ; length
195 heavyiron 59
		db	'kolibri_user           '	  ; string
1188 clevermous 60
user_nick_max = $ - user_nick - 4
31 halyavin 61
 
195 heavyiron 62
user_real_name	dd	14				  ; length
63
		db	'KolibriOS User         '	  ; string
1188 clevermous 64
user_real_name_max = $ - user_real_name - 4
31 halyavin 65
 
66
 
195 heavyiron 67
START:				; start of execution
31 halyavin 68
 
1188 clevermous 69
    stdcall dll.Load, @IMPORT
70
    test eax,eax
71
    jnz  exit
72
 
31 halyavin 73
    mov  eax,40
1188 clevermous 74
    mov  ebx,11000111b
485 heavyiron 75
    mcall
1188 clevermous 76
    mcall 60, 1, ipcbuf, ipcbuf.size
77
    mcall 9, 0xe0000, -1
78
    mov  eax,[ebx+process_information.PID]
79
    mov  [main_PID],eax
31 halyavin 80
 
1188 clevermous 81
	mov	esi, def_server_name
82
	mov	edi, irc_server_name
83
@@:
84
	lodsb
85
	stosb
86
	test	al, al
87
	jnz	@b
88
 
31 halyavin 89
    mov  edi,I_END
90
    mov  ecx,60*120
1188 clevermous 91
    mov  al,32
31 halyavin 92
    cld
93
    rep  stosb
94
 
95
    mov  eax,[rxs]
96
    imul eax,11
97
    mov  [pos],eax
98
 
99
    mov  ebp,0
100
    mov  edx,I_END
556 heavyiron 101
 
102
redraw: 			; redraw
195 heavyiron 103
    call draw_window		; at first, draw the window
31 halyavin 104
 
105
still:
106
 
1726 ataualpa 107
    mov  eax,10 		; wait here for event
485 heavyiron 108
    mcall
31 halyavin 109
 
1726 ataualpa 110
    dec  eax			; redraw
195 heavyiron 111
    je	 redraw
1188 clevermous 112
    dec  eax			; key
195 heavyiron 113
    je	 main_window_key
1188 clevermous 114
    dec  eax			; button
195 heavyiron 115
    je	 button
1188 clevermous 116
    cmp  al,4
1726 ataualpa 117
    jz	 ipc
31 halyavin 118
 
1188 clevermous 119
    call process_network_event
120
 
31 halyavin 121
    cmp  [I_END+120*60],byte 1
122
    jne  no_main_update
123
    mov  [I_END+120*60],byte 0
124
    mov  edx,I_END
125
    call draw_channel_text
126
  no_main_update:
127
 
128
    call print_channel_list
129
 
130
    jmp  still
131
 
195 heavyiron 132
button: 			; button
31 halyavin 133
 
195 heavyiron 134
    mov  eax,17 		; get id
485 heavyiron 135
    mcall
31 halyavin 136
 
195 heavyiron 137
    cmp  ah,1			; close program
31 halyavin 138
    jne  noclose
1188 clevermous 139
exit:
1726 ataualpa 140
    or	 eax,-1
485 heavyiron 141
    mcall
31 halyavin 142
  noclose:
1188 clevermous 143
    cmp  ah,21
144
    jne  no_change_encoding
145
    cmp  byte[edx-1],0
146
    jnz  still
147
    mov  eax,[encoding]
148
    inc  eax
149
    mov  edx,msgbox_struct
150
    mov  byte[edx],al
151
    mov  byte[edx-1],1 ; msgbox is running
152
    push mb_stack
153
    push edx
154
    call [mb_create]
155
    push msgbox_func_array
156
    call [mb_setfunctions]
157
    jmp  still
158
  no_change_encoding:
31 halyavin 159
 
160
    call socket_commands
161
 
162
    jmp  still
163
 
1188 clevermous 164
ipc:
165
    mov  edx,msgbox_struct
166
    cmp  byte[edx-1],0
1726 ataualpa 167
    jz	 @f
1188 clevermous 168
    mov  byte[edx-1],0
169
    mov  al,[edx]
170
    dec  eax
171
    mov  byte[encoding],al
172
    call update_encoding
173
    jmp  ipc_done
174
@@:
175
    call process_command
176
ipc_done:
177
    mov  dword [ipcbuf+4], 8
178
    jmp  still
31 halyavin 179
 
180
main_window_key:
181
 
182
    mov  eax,2
485 heavyiron 183
    mcall
31 halyavin 184
 
185
    shr  eax,8
186
 
187
    cmp  eax,8
188
    jne  no_bks2
189
    cmp  [xpos],0
195 heavyiron 190
    je	 still
31 halyavin 191
    dec  [xpos]
192
    call print_entry
193
    jmp  still
194
   no_bks2:
195
 
196
    cmp  eax,20
197
    jbe  no_character2
198
    mov  ebx,[xpos]
199
    mov  [send_string+ebx],al
200
    inc  [xpos]
201
    cmp  [xpos],80
195 heavyiron 202
    jb	 noxposdec
31 halyavin 203
    mov  [xpos],79
204
  noxposdec:
205
    call print_entry
206
    jmp  still
207
  no_character2:
208