Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                   ;;
3
;;    POP CLIENT for MenuetOS                        ;;
4
;;    - Modified from IRC client                     ;;
5
;;                                                   ;;
6
;;    License: GPL / See file COPYING for details    ;;
7
;;    Copyright 2002 (c) Ville Turjanmaa             ;;
8
;;                                                   ;;
9
;;    Compile with FASM for Menuet                   ;;
10
;;                                                   ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
 
13
version equ '0.1'
14
 
15
use32
16
 
17
                org     0x0
18
 
19
                db      'MENUET01'              ; 8 byte id
20
                dd      0x01                    ; required os
21
                dd      START                   ; program start
22
                dd      I_END                   ; program image size
23
                dd      0x200000                ; required amount of memory
24
                dd      0xffff0
25
                dd      0,0
26
 
27
START:                          ; start of execution
28
 
29
    mov  [file_start],0x100000
30
 
484 diamond 31
    mov  eax,70
31 halyavin 32
    mov  ebx,filel
33
    int  0x40
34
 
484 diamond 35
    test eax,eax
36
    jz   @f
37
    cmp  eax,6
38
    jnz  notfound
39
@@:
31 halyavin 40
    add  [file_start],ebx
41
  notfound:
42
 
43
    mov  edi,I_END
44
    mov  ecx,60*120
484 diamond 45
    mov  al,32
31 halyavin 46
    cld
47
    rep  stosb
48
 
49
    mov  eax,[rxs]
50
    imul eax,11
51
    mov  [pos],eax
52
 
53
    mov  ebp,0
54
    mov  edx,I_END
55
    call draw_window            ; at first, draw the window
56
 
57
still:
58
 
59
    mov  eax,5
60
    mov  ebx,1
61
    int  0x40
62
 
63
    mov  eax,11                 ; wait here for event
64
    int  0x40
65
 
66
    cmp  eax,1                  ; redraw
67
    je   redraw
68
    cmp  eax,2                  ; key
69
    je   key
70
    cmp  eax,3                  ; button
71
    je   button
72
 
73
    cmp  [I_END+120*60],byte 1
74
    jne  no_main_update
75
    mov  [I_END+120*60],byte 0
76
    mov  edx,I_END
77
    call draw_server_data
78
  no_main_update:
79
 
80
    cmp  [server_active],0
81
    je   noread
82
    call read_incoming_data
83
  noread:
84
 
85
    call print_status
86
 
87
    cmp  [status],4
88
    je   send_request
89
 
90
    jmp  still
91
 
92
 
93
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
94
;;
95
;;  Save the fetched mails
96
;;
97
 
98
 
99
save_file:
100
 
101
   pusha
102
 
484 diamond 103
   mov  ebx,files
31 halyavin 104
   mov  eax,[file_start]
105
   sub  eax,0x100000
484 diamond 106
   mov  [ebx+12],eax
31 halyavin 107
 
484 diamond 108
   mov  eax,70
31 halyavin 109
   int  0x40
110
 
111
   popa
112
 
113
   ret
114
 
115
 
116
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
117
;;
118
;;  Send user id/passwd/mailrq
119
;;
120
 
121
 
122
send_request:
123
 
124
    inc  [mcounter]
125
 
126
    cmp  [mcounter],1000
127
    jbe  no_send
128
 
129
    mov  eax,[ccounter]
130
    imul  eax,32
131
    add  eax,getmail
132
    mov  esi,eax
133
 
134
    inc  [ccounter]
135
 
136
    mov  edx,32
137
 
138
    cmp  [ccounter],1
139
    jne  no1
140
    mov  edx,5+2
141
    add  edx,[l2]
142
  no1:
143
 
144
    cmp  [ccounter],2
145
    jne  no2
146
    mov  edx,5+2
147
    add  edx,[l3]
148
  no2:
149
 
150
    mov  eax,53
151
    mov  ebx,7
152
    mov  ecx,[socket]
153
    int  0x40
154
    mov  [mcounter],0
155
 
156
    cmp  [esi],dword 'quit'
157
    je   close_fetch
158
 
159
 
160
  no_send:
161
 
162
    jmp  still
163
 
164
 
165
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
166
;;
167
;;  Close connection to server
168
;;
169
 
170
 
171
close_fetch:
172
 
173
    mov  eax,53
174
    mov  ebx,7
175
    mov  ecx,[socket]
176
    mov  edx,14
177
    mov  esi,quitc
178
    int  0x40
179
    mov  [mcounter],0
180
 
181
    mov  eax,5
182
    mov  ebx,150
183
    int  0x40
184
 
185
    call read_incoming_data
186
 
187
    mov  eax,53
188
    mov  ebx,8
189
    mov  ecx,[socket]
190
    int  0x40
191
 
192
    mov  eax,5
193
    mov  ebx,2
194
    int  0x40
195
 
196
    mov  eax,53
197
    mov  ebx,8
198
    mov  ecx,[socket]
199
    int  0x40
200
 
201
    mov  [server_active],0
202
 
203
    jmp  still
204
 
205
 
206
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
207
;;
208
;;  User input processing
209
;;
210
 
211
 
212
redraw:                         ; redraw
213
 
214
    call draw_window
215
    jmp  still
216
 
217
 
218
key:
219
 
220
    mov  eax,2
221
    int  0x40
222
 
223
    jmp  still
224
 
225
 
226
button:                         ; button
227
 
228
    mov  eax,17                 ; get id
229
    int  0x40
230
 
231
    cmp  ah,60
232
    jne  no_open
484 diamond 233
        mov     eax, 70
234
        mov     ebx, tinypad_start
235
        int     0x40
31 halyavin 236
    jmp  still
237
  no_open:
238
 
239
    cmp  ah,1                   ; close program
240
    jne  noclose
241
    mov  eax,-1
242
    int  0x40
243
  noclose:
244
 
245
    cmp  ah,51
246
    je   read_string
247
    cmp  ah,52
248
    je   read_string
249
    cmp  ah,53
250
    je   read_string
251
 
252
    call socket_commands
253
 
254
    jmp  still
255
 
256
 
257
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
258
;;
259
;;  Socket open & close
260
;;
261
 
262
socket_commands:
263
 
264
    cmp  ah,22       ; open socket
265
    jnz  tst3
266
 
267
    mov  [server_active],1
268
 
269
    mov  [mcounter],900
270
    mov  [ccounter],0
271
 
272
    mov  eax,3
273
    int  0x40
274
 
275
    mov  eax,3
276
    int  0x40
277