2013-05-28 21:34:26 +04:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2014-01-18 19:51:43 +04:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
|
2013-05-28 21:34:26 +04:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; IRC client for KolibriOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Written by hidnplayr@kolibrios.org, ;;
|
|
|
|
;; text encoder/decoder by Clevermouse. ;;
|
|
|
|
;; ;;
|
|
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
|
|
;; Version 2, June 1991 ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2014-03-16 15:50:59 +04:00
|
|
|
version equ '0.21'
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; connection status
|
|
|
|
STATUS_DISCONNECTED = 0
|
|
|
|
STATUS_RESOLVING = 1
|
|
|
|
STATUS_CONNECTING = 2
|
|
|
|
STATUS_CONNECTED = 3
|
|
|
|
|
|
|
|
; window flags
|
|
|
|
FLAG_UPDATED = 1 shl 0
|
2013-11-01 18:02:08 +04:00
|
|
|
FLAG_RECEIVING_NAMES = 1 shl 1
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; window types
|
2013-11-01 18:02:08 +04:00
|
|
|
WINDOWTYPE_NONE = 0
|
|
|
|
WINDOWTYPE_SERVER = 1
|
|
|
|
WINDOWTYPE_CHANNEL = 2
|
|
|
|
WINDOWTYPE_CHAT = 3
|
|
|
|
WINDOWTYPE_LIST = 4
|
|
|
|
WINDOWTYPE_DCC = 5
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; supported encodings
|
|
|
|
CP866 = 0
|
|
|
|
CP1251 = 1
|
|
|
|
UTF8 = 2
|
|
|
|
|
|
|
|
; settings
|
|
|
|
USERCMD_MAX_SIZE = 400
|
|
|
|
|
|
|
|
WIN_MIN_X = 600
|
2013-11-01 18:02:08 +04:00
|
|
|
WIN_MIN_Y = 170
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
TEXT_X = 5
|
2013-11-01 18:02:08 +04:00
|
|
|
TEXT_Y = TOP_Y + 2
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
TOP_Y = 24
|
|
|
|
BOTTOM_Y = 15
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
MAX_WINDOWS = 20
|
|
|
|
MAX_USERS = 4096
|
2014-01-18 19:51:43 +04:00
|
|
|
TEXT_BUFFERSIZE = 1024*1024
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
MAX_NICK_LEN = 32
|
|
|
|
MAX_REAL_LEN = 32 ; realname
|
|
|
|
MAX_SERVER_NAME = 256
|
|
|
|
|
|
|
|
MAX_CHANNEL_LEN = 40
|
|
|
|
MAX_CHANNELS = 37
|
|
|
|
|
|
|
|
MAX_COMMAND_LEN = 512
|
|
|
|
|
|
|
|
TIMESTAMP = 3 ; 3 = hh:mm:ss, 2 = hh:mm, 0 = no timestamp
|
|
|
|
|
|
|
|
MAX_WINDOWNAME_LEN = 256
|
|
|
|
|
|
|
|
WINDOW_BTN_START = 100
|
2013-10-07 18:02:05 +04:00
|
|
|
WINDOW_BTN_CLOSE = 2
|
|
|
|
WINDOW_BTN_LIST = 3
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
SCROLLBAR_WIDTH = 14
|
|
|
|
USERLIST_WIDTH = 100
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
FONT_HEIGHT = 9
|
|
|
|
FONT_WIDTH = 6
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
format binary as ""
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
|
|
|
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 1 ; header version
|
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; program image size
|
|
|
|
dd IM_END+2048 ; required amount of memory
|
|
|
|
dd IM_END+2048
|
|
|
|
dd param
|
|
|
|
dd path
|
|
|
|
|
2013-06-07 21:26:03 +04:00
|
|
|
include "../../macros.inc"
|
|
|
|
include "../../proc32.inc"
|
|
|
|
include "../../dll.inc"
|
|
|
|
include "../../network.inc"
|
|
|
|
include "../../struct.inc"
|
2014-01-18 19:51:43 +04:00
|
|
|
include "../../develop/libraries/box_lib/trunk/box_lib.mac"
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
struct window
|
2013-11-01 18:02:08 +04:00
|
|
|
data_ptr dd ?
|
2013-05-28 21:34:26 +04:00
|
|
|
flags db ?
|
|
|
|
type db ?
|
|
|
|
name rb MAX_WINDOWNAME_LEN
|
|
|
|
users dd ?
|
|
|
|
users_scroll dd ?
|
|
|
|
selected dd ? ; selected user, 0 if none selected
|
2013-11-01 18:02:08 +04:00
|
|
|
|
|
|
|
text_start dd ? ; pointer to current textbox data
|
|
|
|
text_end dd ?
|
|
|
|
text_print dd ? ; pointer to first character to print on screen
|
|
|
|
text_line_print dd ? ; line number of that character
|
|
|
|
text_write dd ? ; write pointer
|
|
|
|
text_lines dd ? ; total number of lines
|
|
|
|
text_scanned dd ? ; pointer to beginning of unscanned data (we still need to count number of lines, insert newline characters,..)
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
ends
|
|
|
|
|
|
|
|
struct window_data
|
2013-11-01 18:02:08 +04:00
|
|
|
text rb TEXT_BUFFERSIZE
|
2013-05-28 21:34:26 +04:00
|
|
|
names rb MAX_NICK_LEN * MAX_USERS
|
|
|
|
ends
|
|
|
|
|
|
|
|
include "encodings.inc"
|
2013-11-01 18:02:08 +04:00
|
|
|
include "window.inc"
|
2013-05-28 21:34:26 +04:00
|
|
|
include "serverparser.inc"
|
|
|
|
include "userparser.inc"
|
|
|
|
include "socket.inc"
|
|
|
|
include "gui.inc"
|
|
|
|
include "users.inc"
|
2013-10-20 22:47:47 +04:00
|
|
|
include "textbox.inc"
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
|
|
|
|
START:
|
|
|
|
|
|
|
|
mcall 68, 11 ; init heap so we can allocate memory dynamically
|
|
|
|
|
|
|
|
; wanted events
|
2013-10-07 18:02:05 +04:00
|
|
|
mcall 40, EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_STACK+EVM_MOUSE+EVM_MOUSE_FILTER
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; load libraries
|
|
|
|
stdcall dll.Load, @IMPORT
|
|
|
|
test eax, eax
|
|
|
|
jnz exit
|
|
|
|
|
|
|
|
; find path to main settings file (ircc.ini)
|
|
|
|
mov edi, path ; Calculate the length of zero-terminated string
|
|
|
|
xor al, al
|
|
|
|
mov ecx, 1024
|
|
|
|
repne scasb
|
|
|
|
dec edi
|
|
|
|
mov eax, '.ini'
|
|
|
|
stosd
|
|
|
|
xor al, al
|
|
|
|
stosb
|
|
|
|
|
|
|
|
; Fill the window buffer with zeros
|
|
|
|
mov edi, windows
|
|
|
|
mov ecx, (sizeof.window*MAX_WINDOWS+3)/4
|
|
|
|
xor eax, eax
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
; clear command area too
|
|
|
|
mov edi, servercommand
|
|
|
|
mov ecx, 600/4
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
; allocate window data block
|
|
|
|
mov ebx, windows
|
2014-01-18 19:51:43 +04:00
|
|
|
call window_create_textbox
|
2013-11-01 18:02:08 +04:00
|
|
|
test eax, eax
|
|
|
|
jz error
|
2013-05-28 21:34:26 +04:00
|
|
|
mov [ebx + window.type], WINDOWTYPE_SERVER
|
|
|
|
|
|
|
|
; get system colors
|
|
|
|
mcall 48, 3, colors, 40
|
|
|
|
|
|
|
|
; set edit box and scrollbar colors
|
|
|
|
mov eax, [colors.work]
|
|
|
|
mov [scroll1.bg_color], eax
|
2013-11-01 18:02:08 +04:00
|
|
|
mov [scroll2.bg_color], eax
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mov eax, [colors.work_button]
|
|
|
|
mov [scroll1.front_color], eax
|
2013-11-01 18:02:08 +04:00
|
|
|
mov [scroll2.front_color], eax
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mov eax, [colors.work_text]
|
|
|
|
mov [scroll1.line_color], eax
|
2013-11-01 18:02:08 +04:00
|
|
|
mov [scroll2.line_color], eax
|
|
|
|
|
|
|
|
mov [scroll1.type], 1 ; 0 = simple, 1 = skinned
|
|
|
|
mov [scroll2.type], 1
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; get settings from ini
|
|
|
|
invoke ini.get_str, path, str_user, str_nick, user_nick, MAX_NICK_LEN, default_nick
|
|
|
|
invoke ini.get_str, path, str_user, str_real, user_real_name, MAX_REAL_LEN, default_real
|
2013-10-07 18:02:05 +04:00
|
|
|
invoke ini.get_str, path, str_user, str_quitmsg, quit_msg, 250, default_quit
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; Welcome user
|
|
|
|
mov esi, str_welcome
|
2014-03-10 01:57:21 +04:00
|
|
|
call print_asciiz
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
; Check if parameter contains an URL
|
|
|
|
cmp byte[param], 0
|
|
|
|
je @f
|
|
|
|
mov esi, param
|
|
|
|
mov ecx, 1024
|
|
|
|
call cmd_usr_server.now
|
|
|
|
@@:
|
|
|
|
|
|
|
|
; Draw window a first time, so we can figure out skin size
|
|
|
|
call draw_window
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
redraw:
|
|
|
|
call draw_window
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
mainloop:
|
|
|
|
mcall 10 ; wait for event
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
dec eax
|
|
|
|
jz redraw
|
|
|
|
|
|
|
|
dec eax
|
|
|
|
jz main_window_key
|
|
|
|
|
|
|
|
dec eax
|
|
|
|
jz button
|
|
|
|
|
|
|
|
cmp al, 3
|
|
|
|
je mouse
|
|
|
|
|
|
|
|
call process_network_event
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
mov edi, [window_active]
|
|
|
|
test [edi + window.flags], FLAG_UPDATED
|
2013-05-28 21:34:26 +04:00
|
|
|
jz .no_update
|
|
|
|
call draw_channel_text
|
2013-11-01 18:02:08 +04:00
|
|
|
mov edi, [window_active]
|
|
|
|
cmp [edi + window.type], WINDOWTYPE_CHANNEL
|
|
|
|
jne .no_update
|
|
|
|
call draw_channel_list
|
2013-05-28 21:34:26 +04:00
|
|
|
.no_update:
|
2014-03-10 01:57:21 +04:00
|
|
|
call highlight_updated_tabs
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
button:
|
|
|
|
|
|
|
|
mcall 17 ; get id
|
2013-10-07 18:02:05 +04:00
|
|
|
ror eax, 8
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
cmp ax, 1 ; close program
|
|
|
|
je exit
|
|
|
|
|
2013-10-07 18:02:05 +04:00
|
|
|
cmp ax, WINDOW_BTN_CLOSE
|
2013-05-28 21:34:26 +04:00
|
|
|
jne @f
|
2013-11-01 18:02:08 +04:00
|
|
|
call cmd_usr_close_window
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-10-07 18:02:05 +04:00
|
|
|
|
|
|
|
@@:
|
|
|
|
cmp ax, WINDOW_BTN_LIST
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
push eax
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall 37, 1 ; Get mouse position
|
|
|
|
sub ax, TEXT_Y
|
2013-11-01 18:02:08 +04:00
|
|
|
mov bl, FONT_HEIGHT
|
2013-05-28 21:34:26 +04:00
|
|
|
div bl
|
|
|
|
and eax, 0x000000ff
|
|
|
|
inc eax
|
|
|
|
add eax, [scroll1.position]
|
2013-10-07 18:02:05 +04:00
|
|
|
mov ebx, [window_active]
|
2013-05-28 21:34:26 +04:00
|
|
|
mov [ebx + window.selected], eax
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
call draw_channel_list
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-10-07 18:02:05 +04:00
|
|
|
pop eax
|
|
|
|
test eax, 1 shl 25 ; Right mouse button pressed?
|
2014-01-18 19:51:43 +04:00
|
|
|
jz mainloop
|
|
|
|
|
|
|
|
; TODO: check if selected nick is my nick!
|
2013-10-07 18:02:05 +04:00
|
|
|
|
|
|
|
; Right mouse BTN was pressed, open chat window
|
|
|
|
mov ebx, [window_active]
|
|
|
|
mov eax, [ebx + window.selected]
|
|
|
|
dec eax
|
|
|
|
imul eax, MAX_NICK_LEN
|
|
|
|
mov ebx, [ebx + window.data_ptr]
|
|
|
|
lea esi, [ebx + window_data.names + eax]
|
|
|
|
call window_open
|
2014-03-10 01:57:21 +04:00
|
|
|
test ebx, ebx
|
|
|
|
jz mainloop
|
|
|
|
mov [window_active], ebx
|
2013-10-07 18:02:05 +04:00
|
|
|
call redraw
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
@@:
|
|
|
|
sub ax, WINDOW_BTN_START
|
|
|
|
jb exit
|
|
|
|
|
|
|
|
cmp ax, MAX_WINDOWS
|
|
|
|
ja exit
|
|
|
|
|
2014-03-10 01:57:21 +04:00
|
|
|
; Save users scrollbar position
|
|
|
|
push [scroll1.position]
|
|
|
|
mov edx, [window_active]
|
|
|
|
pop [edx + window.users_scroll]
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
; OK, time to switch to another window.
|
2013-05-28 21:34:26 +04:00
|
|
|
mov dx, sizeof.window
|
|
|
|
mul dx
|
|
|
|
shl edx, 16
|
|
|
|
mov dx, ax
|
|
|
|
add edx, windows
|
2013-11-01 18:02:08 +04:00
|
|
|
cmp [edx + window.type], WINDOWTYPE_NONE
|
2013-05-28 21:34:26 +04:00
|
|
|
je exit
|
2013-10-07 18:02:05 +04:00
|
|
|
mov [window_active], edx
|
2013-11-01 18:02:08 +04:00
|
|
|
|
2014-03-08 21:31:33 +04:00
|
|
|
push [edx + window.text_line_print]
|
|
|
|
pop [scroll2.position]
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-03-10 01:57:21 +04:00
|
|
|
push [edx + window.users_scroll]
|
|
|
|
pop [scroll1.position]
|
|
|
|
|
2014-03-08 21:31:33 +04:00
|
|
|
call draw_window
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-10-07 18:02:05 +04:00
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
exit:
|
2013-10-07 18:02:05 +04:00
|
|
|
|
|
|
|
cmp [socketnum], 0
|
|
|
|
je @f
|
|
|
|
mov esi, quit_msg
|
|
|
|
call cmd_usr_quit_server
|
|
|
|
@@:
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
error:
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
mcall -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main_window_key:
|
|
|
|
|
|
|
|
mcall 2
|
|
|
|
|
|
|
|
push dword edit1
|
|
|
|
call [edit_box_key]
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
; cmp ah, 178
|
|
|
|
; jne .no_up
|
|
|
|
;
|
2014-01-18 19:51:43 +04:00
|
|
|
; jmp mainloop
|
2013-11-01 18:02:08 +04:00
|
|
|
;
|
|
|
|
;
|
|
|
|
; .no_up:
|
|
|
|
; cmp ah, 177
|
|
|
|
; jne .no_down
|
|
|
|
;
|
2014-01-18 19:51:43 +04:00
|
|
|
; jmp mainloop
|
2013-11-01 18:02:08 +04:00
|
|
|
;
|
|
|
|
; .no_down:
|
2013-05-28 21:34:26 +04:00
|
|
|
cmp ah, 13 ; enter
|
|
|
|
jne no_send2
|
|
|
|
|
|
|
|
call user_parser
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
mov eax, [edit1.size]
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
mov [edit1.size], 0
|
|
|
|
mov [edit1.pos], 0
|
|
|
|
|
|
|
|
push dword edit1
|
|
|
|
call [edit_box_draw]
|
|
|
|
|
|
|
|
call draw_channel_text
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-05-28 21:34:26 +04:00
|
|
|
no_send2:
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
mouse:
|
|
|
|
push dword edit1
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
; mcall 37, 7
|
|
|
|
; movsx eax, ax
|
|
|
|
; add [scroll2.position], eax
|
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
; TODO: check if scrollbar is active?
|
|
|
|
mov edi, [window_active]
|
|
|
|
cmp [edi + window.type], WINDOWTYPE_CHANNEL
|
|
|
|
jne @f
|
2013-05-28 21:34:26 +04:00
|
|
|
push [scroll1.position]
|
|
|
|
push dword scroll1
|
2013-11-01 18:02:08 +04:00
|
|
|
call [scrollbar_mouse]
|
2013-05-28 21:34:26 +04:00
|
|
|
pop eax
|
|
|
|
cmp eax, [scroll1.position] ; did the scrollbar move?
|
|
|
|
je @f
|
2013-11-01 18:02:08 +04:00
|
|
|
call draw_channel_list
|
|
|
|
@@:
|
|
|
|
|
|
|
|
; TODO: check if scrollbar is active?
|
|
|
|
mov edi, [window_active]
|
|
|
|
mov eax, [edi + window.text_lines]
|
|
|
|
cmp eax, [textbox_height]
|
|
|
|
jbe @f
|
|
|
|
push dword scroll2
|
|
|
|
call [scrollbar_mouse]
|
2014-01-18 19:51:43 +04:00
|
|
|
mov edi, [window_active]
|
2013-11-01 18:02:08 +04:00
|
|
|
mov edx, [scroll2.position]
|
|
|
|
sub edx, [edi + window.text_line_print]
|
|
|
|
je @f
|
|
|
|
call draw_channel_text.scroll_to_pos
|
2013-05-28 21:34:26 +04:00
|
|
|
@@:
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
jmp mainloop
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
encoding_text:
|
|
|
|
db 'CP866 '
|
|
|
|
db 'CP1251'
|
|
|
|
db 'UTF-8 '
|
|
|
|
encoding_text_len = 6
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
join_header db 3, '3* ', 0
|
|
|
|
quit_header db 3, '5* ', 0
|
|
|
|
nick_header db 3, '2* ', 0
|
|
|
|
kick_header db 3, '5* ', 0
|
|
|
|
mode_header db 3, '2* ', 0
|
|
|
|
part_header db 3, '5* ', 0
|
|
|
|
topic_header db 3, '3* ', 0
|
|
|
|
action_header db 3, '6* ', 0
|
|
|
|
ctcp_header db 3, '13-> [', 0
|
|
|
|
msg_header db 3, '7-> *', 0
|
|
|
|
ctcp_version db '] VERSION', 10, 0
|
|
|
|
ctcp_ping db '] PING', 10, 0
|
|
|
|
ctcp_time db '] TIME', 10, 0
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
has_left_channel db ' has left ', 0
|
|
|
|
joins_channel db ' has joined ', 0
|
|
|
|
is_now_known_as db ' is now known as ', 0
|
2014-03-10 01:57:21 +04:00
|
|
|
has_quit_irc db ' has quit IRC', 10, 0
|
2014-01-18 19:51:43 +04:00
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
sets_mode db ' sets mode ', 0
|
2014-02-26 02:19:28 +04:00
|
|
|
str_kicked db ' is kicked from ', 0
|
|
|
|
str_by db ' by ', 0
|
2014-01-18 19:51:43 +04:00
|
|
|
str_nickchange db 'Nickname is now ', 0
|
|
|
|
str_realchange db 'Real name is now ', 0
|
|
|
|
str_talking db 'Now talking in ', 0
|
|
|
|
str_topic db 'Topic is "', 0
|
2014-03-10 01:57:21 +04:00
|
|
|
str_topic_end db '"', 10, 0
|
2014-01-18 19:51:43 +04:00
|
|
|
str_setby db 'Set by ', 0
|
|
|
|
|
|
|
|
str_connecting db 3, '3* Connecting to ', 0
|
|
|
|
str_sockerr db 3, '5* Socket error', 10, 0
|
|
|
|
str_dnserr db 3, '5* Unable to resolve hostname', 10, 0
|
|
|
|
str_refused db 3, '5* Connection refused', 10, 0
|
|
|
|
str_disconnected db 3, '5* Server disconnected', 10, 0
|
|
|
|
str_reconnect db 3, '5* Connection reset by user', 10, 0
|
|
|
|
str_notconnected db 3, '5* Not connected to server', 10, 0
|
|
|
|
|
|
|
|
str_1 db 3, '13 -', 0
|
|
|
|
str_2 db '- ', 0
|
|
|
|
|
2014-03-10 01:57:21 +04:00
|
|
|
str_list db 'list', 0
|
|
|
|
|
|
|
|
str_help db 'The following commands are available:', 10
|
|
|
|
db 10
|
|
|
|
db '/nick <nick> : change nickname', 10
|
|
|
|
db '/real <real name> : change real name', 10
|
|
|
|
db '/server <address> : connect to server', 10
|
|
|
|
db '/code <code> : change codepage (cp866, cp1251, or utf8)', 10
|
|
|
|
db '/join <channel> : join a channel', 10
|
|
|
|
db '/part <channel> : part from a channel', 10
|
|
|
|
db '/quit : quit server', 10
|
|
|
|
db '/msg <user> : send a private message', 10
|
|
|
|
db '/ctcp <user> : send a message using client to client protocol', 10
|
2014-01-18 19:51:43 +04:00
|
|
|
db 10
|
2014-03-10 01:57:21 +04:00
|
|
|
db 'Other commands are send straight to server.', 10
|
|
|
|
db 10, 0
|
2014-01-18 19:51:43 +04:00
|
|
|
|
|
|
|
str_welcome db 3, '3 ___', 3, '7__________', 3, '6_________ ', 3, '4 __ __ __', 10
|
|
|
|
db 3, '3| \', 3, '7______ \', 3, '6_ ___ \ ', 3, '4 ____ | | |__| ____ _____/ |_', 10
|
|
|
|
db 3, '3| |', 3, '7| _/', 3, '6 \ \/ ', 3, '4 _/ ___\| | | |/ __ \ / \ __\', 10
|
|
|
|
db 3, '3| |', 3, '7| | \', 3, '6 \____', 3, '4 \ \___| |_| \ ___/| | \ |', 10
|
|
|
|
db 3, '3|___|', 3, '7|____|_ /', 3, '6\______ /', 3, '4 \___ >____/__|\___ >___| /__|', 10
|
|
|
|
db 3, '3 ', 3, '7 \/ ', 3, '6 \/ ', 3, '4 \/ \/ \/', 10
|
|
|
|
db 10
|
|
|
|
db 'Welcome to the KolibriOS IRC client v', version, 10
|
|
|
|
db 10
|
|
|
|
db 'Type /help for help', 10, 10, 0
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
str_version db 'VERSION '
|
2014-01-18 19:51:43 +04:00
|
|
|
str_programname db 'KolibriOS IRC client v', version, 0
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
str_user db 'user', 0
|
|
|
|
str_nick db 'nick', 0
|
|
|
|
str_real db 'realname', 0
|
|
|
|
str_email db 'email', 0
|
2013-10-07 18:02:05 +04:00
|
|
|
str_quitmsg db 'quitmsg', 0
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
default_nick db 'kolibri_user', 0
|
|
|
|
default_real db 'Kolibri User', 0
|
2013-10-07 18:02:05 +04:00
|
|
|
default_quit db 'KolibriOS forever', 0
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-11-01 18:02:08 +04:00
|
|
|
irc_colors dd 0xffffff ; 0 white
|
|
|
|
dd 0x000000 ; 1 black
|
|
|
|
dd 0x00007f ; 2 blue (navy)
|
|
|
|
dd 0x009300 ; 3 green
|
|
|
|
dd 0xff0000 ; 4 red
|
|
|
|
dd 0x7f0000 ; 5 brown (maroon)
|
|
|
|
dd 0x9c009c ; 6 purple
|
|
|
|
dd 0xfc7f00 ; 7 olive
|
|
|
|
dd 0xffff00 ; 8 yellow
|
|
|
|
dd 0x00fc00 ; 9 light green
|
|
|
|
dd 0x009393 ; 10 teal
|
|
|
|
dd 0x00ffff ; 11 cyan
|
|
|
|
dd 0x0000fc ; 12 royal blue
|
|
|
|
dd 0xff00ff ; 13 pink
|
|
|
|
dd 0x7f7f7f ; 14 grey
|
|
|
|
dd 0xd4d0c4 ; 15 light grey (silver)
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
sockaddr1:
|
|
|
|
dw AF_INET4
|
2014-01-18 19:51:43 +04:00
|
|
|
.port dw 0x0b1a ; 6667 FIXMEEEEEE
|
2013-05-28 21:34:26 +04:00
|
|
|
.ip dd 0
|
|
|
|
rb 10
|
|
|
|
|
|
|
|
|
|
|
|
status dd STATUS_DISCONNECTED
|
|
|
|
|
2013-10-07 18:02:05 +04:00
|
|
|
window_active dd windows
|
2013-05-28 21:34:26 +04:00
|
|
|
window_print dd windows
|
|
|
|
|
|
|
|
align 4
|
|
|
|
@IMPORT:
|
|
|
|
|
|
|
|
library network, 'network.obj',\
|
|
|
|
libini, 'libini.obj',\
|
|
|
|
boxlib, 'box_lib.obj'
|
|
|
|
|
|
|
|
import network,\
|
|
|
|
getaddrinfo, 'getaddrinfo',\
|
|
|
|
freeaddrinfo, 'freeaddrinfo',\
|
|
|
|
inet_ntoa, 'inet_ntoa'
|
|
|
|
|
|
|
|
import libini,\
|
|
|
|
ini.get_str, 'ini_get_str',\
|
|
|
|
ini.get_int, 'ini_get_int'
|
|
|
|
|
|
|
|
import boxlib,\
|
2013-11-01 18:02:08 +04:00
|
|
|
edit_box_draw, 'edit_box',\
|
|
|
|
edit_box_key, 'edit_box_key',\
|
|
|
|
edit_box_mouse, 'edit_box_mouse',\
|
|
|
|
scrollbar_draw, 'scrollbar_v_draw',\
|
|
|
|
scrollbar_mouse,'scrollbar_v_mouse'
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
; width, left, top
|
2014-03-16 15:50:59 +04:00
|
|
|
edit1 edit_box 0, 0, 0, 0xffffff, 0x6f9480, 0, 0, 0, USERCMD_MAX_SIZE, usercommand, mouse_dd, ed_always_focus, 25, 25
|
2013-11-01 18:02:08 +04:00
|
|
|
; xsize, xpos, ysize, ypos, btn_height, max, cur, pos, bgcol, frcol, linecol
|
|
|
|
scroll1 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
|
|
|
|
scroll2 scrollbar SCROLLBAR_WIDTH, 0, 0, TOP_Y, SCROLLBAR_WIDTH, 0, 0, 0, 0, 0, 0, 1
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2013-06-07 21:26:03 +04:00
|
|
|
usercommand db '/server chat.freenode.net', 0
|
|
|
|
rb MAX_COMMAND_LEN
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
I_END:
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
utf8_bytes_rest dd ? ; bytes rest in current UTF8 sequence
|
|
|
|
utf8_char dd ? ; first bits of current UTF8 character
|
2014-01-18 19:51:43 +04:00
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
packetbuf rb 1024 ; buffer for packets to server
|
|
|
|
path rb 1024
|
|
|
|
param rb 1024
|
|
|
|
|
|
|
|
servercommand rb 600
|
|
|
|
|
2014-03-21 14:52:46 +04:00
|
|
|
thread_info process_information
|
2013-05-28 21:34:26 +04:00
|
|
|
xsize dd ?
|
|
|
|
ysize dd ?
|
2014-01-18 19:51:43 +04:00
|
|
|
mouse_dd dd ?
|
2013-05-28 21:34:26 +04:00
|
|
|
|
2014-03-08 21:31:33 +04:00
|
|
|
textbox_height dd ? ; in characters
|
|
|
|
textbox_width dd ? ; in characters, not pixels ;)
|
|
|
|
|
2013-05-28 21:34:26 +04:00
|
|
|
colors system_colors
|
|
|
|
|
2014-01-18 19:51:43 +04:00
|
|
|
irc_server_name rb MAX_SERVER_NAME ; TODO: move this server URL into window struct
|
|
|
|
socketnum dd ? ; TODO: same for socket
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
user_nick rb MAX_NICK_LEN
|
|
|
|
user_real_name rb MAX_REAL_LEN
|
2013-10-07 18:02:05 +04:00
|
|
|
quit_msg rb 250
|
2013-05-28 21:34:26 +04:00
|
|
|
|
|
|
|
windows rb MAX_WINDOWS*sizeof.window
|
|
|
|
|
2014-03-10 01:57:21 +04:00
|
|
|
IM_END:
|