This repository has been archived by the owner on Mar 14, 2021. It is now read-only.
forked from nickgammon/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reconnecter.xml
207 lines (161 loc) · 3.88 KB
/
Reconnecter.xml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
<!ENTITY interval "10" >
<!ENTITY quit_command "QUIT" >
<!ENTITY connect_command "CONNECT" >
<!ENTITY noconnect_command "NOCONNECT" >
]>
<!-- Saved on Monday, September 30, 2002, 6:21 PM -->
<!-- MuClient version 3.26 -->
<!-- Plugin "Reconnecter" generated by Plugin Wizard -->
<!--
1. Change the entity above "interval" to be the number of seconds
between retries.
2. Change the entity above "quit_command" to be the command you
type to quit (eg. quit, QUIT, @quit or whatever)
3. Change the entity above "connect_command" to be the command you
type to enable connection checking.
4. Change the entity above "noconnect_command" to be the command you
type to disable connection checking.
-->
<muclient>
<plugin
name="Reconnecter"
author="Nick Gammon"
id="83beba4e37b3d0e7f63cedbc"
language="VBscript"
purpose="Reconnects when disconnected"
date_written="2002-09-30 18:20:24"
requires="3.22"
version="1.0"
>
<description trim="y">
<![CDATA[
This plugin will automatically reconnect you when you are disconnected,
at a user-configurable interval (say, every 5 seconds)
]]>
Reconnecter:help - this help screen
&connect_command; - enable recconnection (eg. after using &noconnect_command;)
&noconnect_command; - disable reconnection (eg. if you are leaving the PC)
</description>
</plugin>
<!-- Timers -->
<timers>
<timer name="ConnectCheckTimer" script="OnConnectCheckTimer"
second="&interval;" active_closed="y" enabled="y">
</timer>
</timers>
<!-- Aliases -->
<aliases>
<alias
script="OnQuit"
match="&quit_command;"
enabled="y"
>
</alias>
<alias
script="OnConnect"
match="&connect_command;"
enabled="y"
>
</alias>
<alias
script="OnNoConnect"
match="&noconnect_command;"
enabled="y"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
dim retry
retry = 0
did_quit = vbFalse
sub OnConnectCheckTimer (sName)
'
' If currently connecting, leave it to do that ...
'
if world.GetInfo (107) then exit sub
'
' If currently connected, we don't need to check any more
'
if world.IsConnected then
world.note "World is connected, disabling disconnection check"
world.enabletimer sName, 0
exit sub
end if
'
' If deliberate quit, we don't need to check any more
'
if did_quit then
world.note "Deliberate quit, disabling disconnection check"
world.enabletimer sName, 0
exit sub
end if
'
' OK, we need to connect now ...
'
retry = retry + 1
world.note "Connecting to world, attempt # " & retry
world.connect
end sub
sub OnPluginDisconnect
'
' If deliberate quit, we don't need to enable the connection check
'
if did_quit then exit sub
'
' We have been disconnected, we need to try connecting again
'
world.note "Connection checker enabled"
world.enabletimer "ConnectCheckTimer", 1
end sub
sub OnPluginConnect
'
' Now we are connected, no need to keep trying to connect
'
retry = 0
world.enabletimer "ConnectCheckTimer", 0
'
' No deliberate quit yet
'
did_quit = vbFalse
end sub
sub OnPluginInstall
world.doafternote 1, "Connection checker installed."
end sub
]]>
sub OnQuit (sName, sLine, wildcards)
did_quit = vbTrue
world.send "&quit_command;" ' send to world so it does it
world.note "Deliberate quit (&quit_command;), reconnect disabled"
end sub
sub OnConnect (sName, sLine, wildcards)
world.note "Connection checker enabled"
world.enabletimer "ConnectCheckTimer", 1
did_quit = vbFalse
end sub
sub OnNoConnect (sName, sLine, wildcards)
world.note "Connection checker disabled"
world.enabletimer "ConnectCheckTimer", 0
did_quit = vbTrue
end sub
</script>
<!-- Plugin help -->
<aliases>
<alias
script="OnHelp"
match="Reconnecter:help"
enabled="y"
>
</alias>
</aliases>
<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
World.Note World.GetPluginInfo (World.GetPluginID, 3)
End Sub
]]>
</script>
</muclient>