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