Rev 9984 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
9978 | hidnplayr | 3 | ;; Copyright (C) KolibriOS team 2004-2024. 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 | |||
9992 | hidnplayr | 16 | version equ '0.36b' |
3545 | hidnplayr | 17 | |
18 | ; connection status |
||
6023 | hidnplayr | 19 | STATUS_DISCONNECTED = 0 |
20 | STATUS_RESOLVING = 1 |
||
21 | STATUS_CONNECTING = 2 |
||
22 | STATUS_CONNECTED = 3 |
||
6027 | hidnplayr | 23 | STATUS_LOGGED_IN = 4 |
3545 | hidnplayr | 24 | |
25 | ; window flags |
||
6023 | hidnplayr | 26 | FLAG_UPDATED = 1 shl 0 |
27 | FLAG_RECEIVING_NAMES = 1 shl 1 |
||
28 | FLAG_SCROLL_LOW = 1 shl 2 |
||
3545 | hidnplayr | 29 | |
30 | ; window types |
||
6023 | hidnplayr | 31 | WINDOWTYPE_NONE = 0 |
32 | WINDOWTYPE_SERVER = 1 |
||
33 | WINDOWTYPE_CHANNEL = 2 |
||
34 | WINDOWTYPE_CHAT = 3 |
||
35 | WINDOWTYPE_LIST = 4 |
||
36 | WINDOWTYPE_DCC = 5 |
||
3545 | hidnplayr | 37 | |
38 | ; supported encodings |
||
6023 | hidnplayr | 39 | CP866 = 0 |
40 | CP1251 = 1 |
||
41 | UTF8 = 2 |
||
3545 | hidnplayr | 42 | |
43 | ; settings |
||
6023 | hidnplayr | 44 | USERCMD_MAX_SIZE = 400 |
3545 | hidnplayr | 45 | |
6023 | hidnplayr | 46 | WIN_MIN_X = 600 |
6026 | hidnplayr | 47 | WIN_MIN_Y = 183 |
3545 | hidnplayr | 48 | |
6026 | hidnplayr | 49 | TEXT_X = 2 |
6023 | hidnplayr | 50 | TEXT_Y = TOP_Y + 2 |
3545 | hidnplayr | 51 | |
6023 | hidnplayr | 52 | TOP_SPACE = 2 |
53 | TAB_HEIGHT = 14 |
||
54 | TAB_WIDTH = 120 |
||
55 | TAB_SPACE = 5 |
||
56 | TOP_Y = TOP_SPACE+ TAB_HEIGHT |
||
57 | INPUTBOX_HEIGHT = 13 |
||
3545 | hidnplayr | 58 | |
6023 | hidnplayr | 59 | MAX_WINDOWS = 20 |
60 | MAX_USERS = 4096 |
||
61 | TEXT_BUFFERSIZE = 1024*1024 |
||
3545 | hidnplayr | 62 | |
6023 | hidnplayr | 63 | MAX_NICK_LEN = 32 |
64 | MAX_REAL_LEN = 32 ; realname |
||
7300 | hidnplayr | 65 | QUIT_MSG_LEN = 250 |
6023 | hidnplayr | 66 | MAX_SERVER_NAME = 256 |
3545 | hidnplayr | 67 | |
6023 | hidnplayr | 68 | MAX_CHANNEL_LEN = 40 |
69 | MAX_CHANNELS = 37 |
||
3545 | hidnplayr | 70 | |
6023 | hidnplayr | 71 | MAX_COMMAND_LEN = 512 |
3545 | hidnplayr | 72 | |
7300 | hidnplayr | 73 | PACKETBUF_SIZE = 1024 |
74 | PATH_SIZE = 1024 |
||
75 | PARAM_SIZE = 1024 |
||
76 | SERVERCOMMAND_SIZE = 600 |
||
77 | |||
6023 | hidnplayr | 78 | TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp |
3545 | hidnplayr | 79 | |
6023 | hidnplayr | 80 | MAX_WINDOWNAME_LEN = 256 |
3545 | hidnplayr | 81 | |
6023 | hidnplayr | 82 | WINDOW_BTN_START = 100 |
83 | WINDOW_BTN_CLOSE = 2 |
||
84 | WINDOW_BTN_LIST = 3 |
||
3545 | hidnplayr | 85 | |
6023 | hidnplayr | 86 | SCROLLBAR_WIDTH = 14 |
6026 | hidnplayr | 87 | USERLIST_WIDTH = 160 |
3545 | hidnplayr | 88 | |
6026 | hidnplayr | 89 | FONT_WIDTH = 8 |
90 | FONT_HEIGHT = 16 |
||
3545 | hidnplayr | 91 | |
92 | format binary as "" |
||
93 | |||
94 | use32 |
||
95 | |||
6023 | hidnplayr | 96 | org 0x0 |
3545 | hidnplayr | 97 | |
6023 | hidnplayr | 98 | db 'MENUET01' ; 8 byte id |
99 | dd 1 ; header version |
||
100 | dd START ; program start |
||
101 | dd I_END ; program image size |
||
102 | dd IM_END+2048 ; required amount of memory |
||
103 | dd IM_END+2048 |
||
104 | dd param |
||
105 | dd path |
||
3545 | hidnplayr | 106 | |
3618 | hidnplayr | 107 | include "../../macros.inc" |
108 | include "../../proc32.inc" |
||
109 | include "../../dll.inc" |
||
110 | include "../../network.inc" |
||
111 | include "../../struct.inc" |
||
4477 | hidnplayr | 112 | include "../../develop/libraries/box_lib/trunk/box_lib.mac" |
3545 | hidnplayr | 113 | |
6023 | hidnplayr | 114 | struct window |
115 | data_ptr dd ? |
||
116 | flags db ? |
||
117 | type db ? |
||
118 | name rb MAX_WINDOWNAME_LEN |
||
119 | users dd ? |
||
120 | users_scroll dd ? |
||
121 | selected dd ? ; selected user, 0 if none selected |
||
4143 | hidnplayr | 122 | |
6023 | hidnplayr | 123 | text_start dd ? ; pointer to current textbox data |
124 | text_end dd ? |
||
125 | text_print dd ? ; pointer to first character to print on screen |
||
126 | text_line_print dd ? ; line number of that character |
||
127 | text_write dd ? ; write pointer |
||
128 | text_lines dd ? ; total number of lines |
||
129 | text_scanned dd ? ; pointer to beginning of unscanned data (we still need to count number of lines, insert newline characters,..) |
||
4143 | hidnplayr | 130 | |
3545 | hidnplayr | 131 | ends |
132 | |||
6023 | hidnplayr | 133 | struct window_data |
134 | text rb TEXT_BUFFERSIZE |
||
135 | names rb MAX_NICK_LEN * MAX_USERS |
||
3545 | hidnplayr | 136 | ends |
137 | |||
138 | include "encodings.inc" |
||
4143 | hidnplayr | 139 | include "window.inc" |
3545 | hidnplayr | 140 | include "serverparser.inc" |
141 | include "userparser.inc" |
||
142 | include "socket.inc" |
||
143 | include "gui.inc" |
||
144 | include "users.inc" |
||
4060 | hidnplayr | 145 | include "textbox.inc" |
3545 | hidnplayr | 146 | |
147 | |||
148 | START: |
||
149 | |||
6023 | hidnplayr | 150 | mcall 68, 11 ; init heap so we can allocate memory dynamically |
3545 | hidnplayr | 151 | |
152 | ; wanted events |
||
6023 | hidnplayr | 153 | mcall 40, EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_STACK+EVM_MOUSE+EVM_MOUSE_FILTER |
3545 | hidnplayr | 154 | |
155 | ; load libraries |
||
6023 | hidnplayr | 156 | stdcall dll.Load, @IMPORT |
157 | test eax, eax |
||
158 | jnz exit |
||
3545 | hidnplayr | 159 | |
160 | ; find path to main settings file (ircc.ini) |
||
6023 | hidnplayr | 161 | mov edi, path ; Calculate the length of zero-terminated string |
162 | xor al, al |
||
7300 | hidnplayr | 163 | mov ecx, PATH_SIZE |
6023 | hidnplayr | 164 | repne scasb |
165 | dec edi |
||
166 | mov eax, '.ini' |
||
167 | stosd |
||
168 | xor al, al |
||
169 | stosb |
||
3545 | hidnplayr | 170 | |
171 | ; Fill the window buffer with zeros |
||
6023 | hidnplayr | 172 | mov edi, windows |
173 | mov ecx, (sizeof.window*MAX_WINDOWS+3)/4 |
||
174 | xor eax, eax |
||
175 | rep stosd |
||
3545 | hidnplayr | 176 | |
177 | ; clear command area too |
||
6023 | hidnplayr | 178 | mov edi, servercommand |
7300 | hidnplayr | 179 | mov ecx, SERVERCOMMAND_SIZE/4 |
6023 | hidnplayr | 180 | rep stosd |
3545 | hidnplayr | 181 | |
182 | ; allocate window data block |
||
6023 | hidnplayr | 183 | mov ebx, windows |
184 | call window_create_textbox |
||
185 | test eax, eax |
||
7300 | hidnplayr | 186 | jz exit |
6023 | hidnplayr | 187 | mov [ebx + window.type], WINDOWTYPE_SERVER |
3545 | hidnplayr | 188 | |
189 | ; get settings from ini |
||
6023 | hidnplayr | 190 | invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick |
191 | invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real |
||
192 | invoke ini.get_str, path, str_user, str_quitmsg, quit_msg, 250, default_quit |
||
3545 | hidnplayr | 193 | |
194 | ; Welcome user |
||
6023 | hidnplayr | 195 | mov esi, str_welcome |
196 | call print_asciiz |
||
3545 | hidnplayr | 197 | |
4477 | hidnplayr | 198 |