/[james]/archive/autofinger/AutoFinger
ViewVC logotype

Contents of /archive/autofinger/AutoFinger

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations) (download)
Tue Jan 28 15:08:19 2003 UTC (21 years, 9 months ago) by james
File size: 2503 byte(s)
Initial import.

1 REM > AutoFinger
2
3 HOST$ = "mail.example.com" :REM name of computer to finger
4 USER$ = "james" :REM user name there
5 POLLTIME% = 60 * 100 :REM interval, centiseconds
6
7 REM--------------------------------------------------------------------------------
8
9 ON ERROR ON ERROR OFF: ERROR 0, "AutoFinger: " + REPORT$ + " (" + STR$ERL + ")": END
10
11 DIM b% 1000, ind% 255
12
13 SYS"Wimp_Initialise", 310, &4b534154, "AutoFinger", 0 TO , task%
14
15 PROCwindow
16
17 PROCfinger
18 REPEAT
19
20 SYS"OS_ReadMonotonicTime" TO time%
21 SYS"Wimp_PollIdle", &1c30, b%, time% + POLLTIME% TO reason%
22
23 CASE reason% OF
24 WHEN 0, 6: PROCfinger
25 WHEN 2: b%!28 = -2: SYS"Wimp_OpenWindow",, b%
26 WHEN 3: SYS"Wimp_CloseWindow",, b%
27 ENDCASE
28 UNTIL (reason% = 17 OR reason% = 18) AND b%!16 = 0
29
30 SYS"Wimp_CloseDown", task%, &4b534154
31 END
32
33 REM--------------------------------------------------------------------------------
34
35 DEF PROCwindow
36 b%!00 = 0: b%!04 = 134: b%!08 = 2000: b%!12 = 178
37 b%!16 = 0: b%!20 = 0
38 b%!24 = -2
39 b%!28 = &80000812
40 b%?32 = 7: b%?33 = 2: b%?34 = 7: b%?35 = 1
41 b%!40 = 0: b%!44 = -44: b%!48 = 2000: b%!52 = 0
42 b%!56 = &0
43 b%!60 = &3000
44 b%!64 = 1
45 b%!68 = 0
46 b%!84 = 1
47
48 b%!88 = 0: b%!92 = -44: b%!96 = 2000: b%!100 = 0
49 b%!104 = &1b003111
50 b%!108 = ind%
51 b%!112 = 0
52 b%!116 = 200
53
54 SYS"Wimp_CreateWindow",, b% TO window%
55 ENDPROC
56
57 REM--------------------------------------------------------------------------------
58
59 DEF PROCclose
60 !b% = window%
61 SYS"Wimp_CloseWindow",, b%
62 ENDPROC
63
64 REM--------------------------------------------------------------------------------
65
66 DEF PROCshow
67 LOCAL width%
68 b%!00 = window%
69 b%!04 = 0
70 b%!08 = 0
71 b%!12 = 0
72 SYS"Wimp_SetIconState",, b%
73 SYS"Wimp_TextOp", 1, ind% TO width%
74 SYS"Wimp_GetWindowState",, b%
75 b%!12 = width% + 20
76 b%!28 = -2
77 SYS"Wimp_OpenWindow",, b%
78 ENDPROC
79
80 REM--------------------------------------------------------------------------------
81
82 DEF PROCfinger
83 LOCAL esocket%, state%, read%, closed%, len%
84
85 SYS"ESocket_ConnectToHost", HOST$, 79 TO esocket%
86 REPEAT
87 SYS"ESocket_CheckState", esocket% TO state%
88 UNTIL state% = 4 OR state% < 0
89
90 IF state% < 0 THEN
91 SYS"ESocket_DecodeState", state% TO $ind%
92 PROCshow
93 ELSE
94 SYS"ESocket_SendLine", esocket%, USER$, 0
95 REPEAT
96 SYS"ESocket_ReadLine", esocket%, ind%, 256, %100 TO , read%, len%
97 SYS"ESocket_Closed", esocket%, 1 TO closed%
98 SYS"Wimp_Poll", &e1ffc, b%
99 UNTIL read% OR closed%
100 IF read% AND len% > 2 THEN
101 PROCshow
102 ELSE
103 PROCclose
104 ENDIF
105 ENDIF
106
107 SYS"ESocket_Forget", esocket%
108 ENDPROC
109

  ViewVC Help
Powered by ViewVC 1.1.26