Rev 5714 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5714 | Rev 5979 | ||
---|---|---|---|
1 | //Leency & SoUrcerer, LGPL |
1 | //Leency & SoUrcerer, LGPL |
2 | 2 | ||
3 | //libraries |
3 | //libraries |
4 | #define MEMSIZE 0x100000 |
4 | #define MEMSIZE 0x100000 |
5 | #include "../lib/kolibri.h" |
5 | #include "../lib/kolibri.h" |
6 | #include "../lib/strings.h" |
6 | #include "../lib/strings.h" |
7 | #include "../lib/mem.h" |
7 | #include "../lib/mem.h" |
8 | #include "../lib/dll.h" |
8 | #include "../lib/dll.h" |
9 | #include "../lib/gui.h" |
9 | #include "../lib/gui.h" |
10 | #include "../lib/file_system.h" |
10 | #include "../lib/file_system.h" |
11 | #include "../lib/list_box.h" |
11 | #include "../lib/list_box.h" |
12 | #include "../lib/socket.h" |
12 | #include "../lib/socket.h" |
13 | #include "../lib/draw_buf.h" |
13 | #include "../lib/draw_buf.h" |
14 | #include "../lib/cursor.h" |
14 | #include "../lib/cursor.h" |
- | 15 | #include "../lib/collection.h" |
|
15 | //*.obj libraries |
16 | //*.obj libraries |
16 | #include "../lib/obj/box_lib.h" |
17 | #include "../lib/obj/box_lib.h" |
17 | #include "../lib/obj/network.h" |
18 | #include "../lib/obj/network.h" |
18 | #include "../lib/obj/libio_lib.h" |
19 | #include "../lib/obj/libio_lib.h" |
19 | #include "../lib/obj/libimg_lib.h" |
20 | #include "../lib/obj/libimg_lib.h" |
20 | #include "../lib/obj/netcode.h" |
21 | #include "../lib/obj/netcode.h" |
21 | #include "../lib/obj/iconv.h" |
22 | #include "../lib/obj/iconv.h" |
- | 23 | //patternts |
|
- | 24 | #include "..\lib\patterns\history.h" |
|
22 | //images |
25 | //images |
23 | byte letter_icons[sizeof(file "img/letter_icons.raw")] = FROM "img/letter_icons.raw"; |
26 | byte letter_icons[sizeof(file "img/letter_icons.raw")] = FROM "img/letter_icons.raw"; |
24 | #include "img/letter_icons.h" |
27 | #include "img/letter_icons.h" |
25 | 28 | ||
26 | //connection algorithm |
29 | //connection algorithm |
27 | enum { |
30 | enum { |
28 | STOP, |
31 | STOP, |
29 | RESOLVE, |
32 | RESOLVE, |
30 | OPEN_CONNECTION, |
33 | OPEN_CONNECTION, |
31 | GET_ANSWER_CONNECT, |
34 | GET_ANSWER_CONNECT, |
32 | SEND_USER, |
35 | SEND_USER, |
33 | GET_ANSWER_USER, |
36 | GET_ANSWER_USER, |
34 | SEND_PASS, |
37 | SEND_PASS, |
35 | GET_ANSWER_PASS, |
38 | GET_ANSWER_PASS, |
36 | SEND_NLIST, |
39 | SEND_NLIST, |
37 | GET_ANSWER_NLIST, |
40 | GET_ANSWER_NLIST, |
38 | SEND_NSTAT, |
41 | SEND_NSTAT, |
39 | GET_ANSWER_NSTAT, |
42 | GET_ANSWER_NSTAT, |
40 | SEND_RETR, |
43 | SEND_RETR, |
41 | GET_ANSWER_RETR |
44 | GET_ANSWER_RETR |
42 | }; |
45 | }; |
43 | 46 | ||
44 | //WindowDefinitions |
47 | //WindowDefinitions |
45 | #define WIN_W 600 |
48 | #define WIN_W 600 |
46 | #define WIN_H 440 |
49 | #define WIN_H 440 |
47 | #define WIN_MIN_W 500 |
50 | #define WIN_MIN_W 500 |
48 | #define WIN_MIN_H 380 |
51 | #define WIN_MIN_H 380 |
49 | #define LOGIN_HEADER "Login - Email client Liza 0.9.4" |
52 | #define LOGIN_HEADER "Login - Email client Liza 0.9.4" |
50 | #define OPTIONS_HEADER "Options - Email client Liza 0.9.4" |
53 | #define OPTIONS_HEADER "Options - Email client Liza 0.9.4" |
51 | #define MAILBOX_HEADER "Mail Box - Email client Liza 0.9.4" |
54 | #define MAILBOX_HEADER "Mail Box - Email client Liza 0.9.4" |
52 | #define BUFFERSIZE 512 |
55 | #define BUFFERSIZE 512 |
53 | proc_info Form; |
56 | proc_info Form; |
54 | #define LBUMP 0xFFFfff |
57 | #define LBUMP 0xFFFfff |
55 | 58 | ||
56 | //progress_bar definitions |
59 | //progress_bar definitions |
57 | char cur_st_percent; |
60 | char cur_st_percent; |
58 | dword cur_st_text; |
61 | dword cur_st_text; |
59 | 62 | ||
60 | //connection data |
63 | //connection data |
61 | #define DEFAULT_POP_PORT 110; |
64 | #define DEFAULT_POP_PORT 110; |
62 | char POP_server_path[128]; |
65 | char POP_server_path[128]; |
63 | dword POP_server_port; |
66 | dword POP_server_port; |
64 | char login[128]; |
67 | char login[128]; |
65 | char request[256+22]; |
68 | char request[256+22]; |
66 | int request_len; |
69 | int request_len; |
67 | char connection_status; |
70 | char connection_status; |
68 | dword socketnum; |
71 | dword socketnum; |
69 | 72 | ||
70 | sockaddr_in sockaddr; |
73 | sockaddr_in sockaddr; |
71 | 74 | ||
72 | int aim; |
75 | int aim; |
73 | int ticks; |
76 | int ticks; |
74 | 77 | ||
75 | char immbuffer[BUFFERSIZE]; |
78 | char immbuffer[BUFFERSIZE]; |
76 | 79 | ||
77 | llist mail_list; |
80 | llist mail_list; |
78 | llist letter_view; |
81 | llist letter_view; |
79 | 82 | ||
80 | dword TAB_H = false; //19; |
83 | dword TAB_H = false; //19; |
81 | dword TAB_W = 150; |
84 | dword TAB_W = 150; |
82 | dword TOOLBAR_H = 31; //50; |
85 | dword TOOLBAR_H = 31; //50; |
83 | dword STATUSBAR_H =15; |
86 | dword STATUSBAR_H =15; |
84 | dword col_bg; |
87 | dword col_bg; |
85 | dword panel_color; |
88 | dword panel_color; |
86 | dword border_color; |
89 | dword border_color; |
87 | 90 | ||
88 | progress_bar wv_progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
91 | progress_bar wv_progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
89 | 92 | ||
90 | int http_transfer; |
93 | int http_transfer; |
91 | char version[]=" WebView 0.1"; |
94 | char version[]=" WebView 0.1"; |
92 | #include "..\TWB\TWB.c" |
95 | #include "..\TWB\TWB.c" |
93 | 96 | ||
94 | #include "settings.c" |
97 | #include "settings.c" |
95 | #include "login.c" |
98 | #include "login.c" |
96 | #include "letter_attr.c" |
99 | #include "letter_attr.c" |
97 | #include "mail_box.c" |
100 | #include "mail_box.c" |
98 | #include "parselist.c" |
101 | #include "parselist.c" |
99 | 102 | ||
100 | void main() { |
103 | void main() { |
101 | 104 | ||
102 | CursorPointer.Load(#CursorFile); |
105 | CursorPointer.Load(#CursorFile); |
103 | load_dll(boxlib, #box_lib_init,0); |
106 | load_dll(boxlib, #box_lib_init,0); |
104 | load_dll(network_lib, #network_lib_init,0); |
107 | load_dll(network_lib, #network_lib_init,0); |
105 | load_dll(netcode_lib, #base64_encode,0); |
108 | load_dll(netcode_lib, #base64_encode,0); |
106 | load_dll(libio, #libio_init,1); |
109 | load_dll(libio, #libio_init,1); |
107 | load_dll(libimg, #libimg_init,1); |
110 | load_dll(libimg, #libimg_init,1); |
108 | load_dll(iconv_lib, #iconv_open,0); |
111 | load_dll(iconv_lib, #iconv_open,0); |
109 | OpenMailDat(); |
112 | OpenMailDat(); |
110 | SetEventMask(0x27); |
113 | SetEventMask(0x27); |
111 | LoginBoxLoop(); |
114 | LoginBoxLoop(); |
112 | } |
115 | } |
113 | 116 | ||
114 | 117 | ||
115 | int DefineWindow(dword wtitle) { |
118 | int DefineWindow(dword wtitle) { |
116 | system.color.get(); |
119 | system.color.get(); |
117 | DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2, WIN_W, WIN_H, 0x73,system.color.work); |
120 | DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2, WIN_W, WIN_H, 0x73,system.color.work); |
118 | DrawTitle(wtitle); |
121 | DrawTitle(wtitle); |
119 | GetProcessInfo(#Form, SelfInfo); |
122 | GetProcessInfo(#Form, SelfInfo); |
120 | if (Form.status_window>2) return 0; //rolled_up |
123 | if (Form.status_window>2) return 0; //rolled_up |
121 | if (Form.width < WIN_MIN_W) MoveSize(OLD,OLD,WIN_MIN_W,OLD); |
124 | if (Form.width < WIN_MIN_W) MoveSize(OLD,OLD,WIN_MIN_W,OLD); |
122 | if (Form.height < WIN_MIN_H) MoveSize(OLD,OLD,OLD,WIN_MIN_H); |
125 | if (Form.height < WIN_MIN_H) MoveSize(OLD,OLD,OLD,WIN_MIN_H); |
123 | return 1; |
126 | return 1; |
124 | } |
127 | } |
125 | 128 | ||
126 | 129 | ||
127 | void OpenMailDat() { |
130 | void OpenMailDat() { |
128 | char read_data[512], pass_b64[256]; |
131 | char read_data[512], pass_b64[256]; |
129 | ReadFile(0, 512, #read_data, "/sys/network/mail.dat"); |
132 | ReadFile(0, 512, #read_data, "/sys/network/mail.dat"); |
130 | if (!read_data) |
133 | if (!read_data) |
131 | { |
134 | { |
132 | strcpy(#email_text, "testliza@ya.ru"); |
135 | strcpy(#email_text, "testliza@ya.ru"); |
133 | strcpy(#pass_text, "kolibri"); |
136 | strcpy(#pass_text, "kolibri"); |
134 | } |
137 | } |
135 | else |
138 | else |
136 | { |
139 | { |
137 | strcpy(#pass_b64, strchr(#read_data, '\n')); |
140 | strcpy(#pass_b64, strchr(#read_data, '\n')); |
138 | base64_decode stdcall (#pass_b64, #pass_text, strlen(#pass_b64)); |
141 | base64_decode stdcall (#pass_b64, #pass_text, strlen(#pass_b64)); |
139 | ESBYTE[strchr(#read_data, '\n')] = NULL; |
142 | ESBYTE[strchr(#read_data, '\n')] = NULL; |
140 | strcpy(#email_text, #read_data); |
143 | strcpy(#email_text, #read_data); |
141 | } |
144 | } |
142 | pass_box.size = pass_box.pos = strlen(#pass_text); |
145 | pass_box.size = pass_box.pos = strlen(#pass_text); |
143 | login_box.size = login_box.pos = strlen(#email_text); |
146 | login_box.size = login_box.pos = strlen(#email_text); |
144 | } |
147 | } |
145 | 148 | ||
146 | void SaveAndExit() { |
149 | void SaveAndExit() { |
147 | char write_data[512], pass_b64[256]; |
150 | char write_data[512], pass_b64[256]; |
148 | Close(socketnum); |
151 | Close(socketnum); |
149 | strcpy(#write_data, #email_text); |
152 | strcpy(#write_data, #email_text); |
150 | chrcat(#write_data, '\n'); |
153 | chrcat(#write_data, '\n'); |
151 | base64_encode stdcall (#pass_text, #pass_b64, strlen(#pass_text)); |
154 | base64_encode stdcall (#pass_text, #pass_b64, strlen(#pass_text)); |
152 | strcat(#write_data, #pass_b64); |
155 | strcat(#write_data, #pass_b64); |
153 | WriteFile(strlen(#write_data)+1, #write_data, "/sys/network/mail.dat"); |
156 | WriteFile(strlen(#write_data)+1, #write_data, "/sys/network/mail.dat"); |
154 | ExitProcess(); |
157 | ExitProcess(); |
155 | } |
158 | } |
156 | 159 | ||
157 | 160 | ||
158 | int GetRequest(dword command, text) { |
161 | int GetRequest(dword command, text) { |
159 | strcpy(#request, command); |
162 | strcpy(#request, command); |
160 | if (text) |
163 | if (text) |
161 | { |
164 | { |
162 | chrcat(#request, ' '); |
165 | chrcat(#request, ' '); |
163 | strcat(#request, text); |
166 | strcat(#request, text); |
164 | } |
167 | } |
165 | strcat(#request, "\n"); |
168 | strcat(#request, "\n"); |
166 | return strlen(#request); |
169 | return strlen(#request); |
167 | } |
170 | } |
168 | 171 | ||
169 | void StopConnect(dword message) { |
172 | void StopConnect(dword message) { |
170 | if (message) notify(message); |
173 | if (message) notify(message); |
171 | aim = STOP; |
174 | aim = STOP; |
172 | Close(socketnum); |
175 | Close(socketnum); |
173 | } |
176 | } |
174 | 177 | ||
175 | stop:>> |
178 | stop:>> |