File: mail.pl

package info (click to toggle)
swi-prolog-packages 5.0.1-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 50,688 kB
  • ctags: 25,904
  • sloc: ansic: 195,096; perl: 91,425; cpp: 7,660; sh: 3,046; makefile: 2,750; yacc: 843; awk: 14; sed: 12
file content (55 lines) | stat: -rw-r--r-- 1,383 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
:- pce_begin_class(mail_tool, frame, 'Mail(1) front-end').

variable(mail,		process,	get,	"The mail process").

initialise(MT) :->
	send(MT, send_super, initialise, 'PceMail --- version 0.0'),
	send(MT, append, new(Headers, browser)),
	send(new(Cmd, dialog), below, Headers),
	send(new(View, view), below, Cmd),
	
	setup_headers(Headers),
	setup_cmd(Cmd),
	setup_process(MT),
	send(MT, open).

setup_headers(Browser) :-
	get(Browser, frame, Tool),
	new(Current, Tool?current),

	send(Browser, multiple_selection, @on),
	send(Browser, open_message, message(Tool, view, Current)).

setup_cmd(Dialog) :-
	get(Dialog, frame, Tool),
	new(Current, Tool?current),
	
	send(Dialog, append, label(reporter)),
	send(Dialog, append, button(print, message(Tool, view, Current))),
	send(Dialog, append, button(reply, message(Tool, reply, Current))),
	send(Dialog, append, button(compose, message(Tool, compose))),
	send(Dialog, append, button(send, message(Tool, send))),
	send(Dialog, append, button(quit, message(Tool, quit))).
	     
setup_process(Tool) :-
	send(Tool, slot, mail, new(Mail, process(mail))),
	send(Tool, wait_for_prompt),
	send(Tool, format, '

open(Tool, Pos:[point]) :->
	"Start process, read headers and open frame"::
	send(Tool, open),
	send(Tool, read_headers).

read_headers(Tool) :->
	send(Tool, wait_for_prompt),
	send(Tool, format, 'h *\n'),
	


:- pce_end_class.