|
7 | 7 | ---------------------------------------------------------------------
|
8 | 8 |
|
9 | 9 | -- everything is saved here
|
10 |
| -servers = {} -- syntax: [server] = {socket=element, name=string, host=string, nick=string, password=string, port=number,secure=bool,nickservpass=string, lastping=number, connected=bool, outputbuffer=table, inputbuffer=string} |
| 10 | +servers = {} -- syntax: [server] = {socket=element, name=string, host=string, nick=string, password=string, port=number,secure=bool, lastping=number, connected=bool, outputbuffer=table, inputbuffer=string, nickservname=string, nickservpass=string} |
11 | 11 |
|
12 | 12 | ------------------------------------
|
13 | 13 | -- Servers
|
@@ -147,10 +147,20 @@ function func_outputIRC (message)
|
147 | 147 | end
|
148 | 148 | registerFunction("outputIRC","func_outputIRC","string")
|
149 | 149 |
|
150 |
| -function func_ircIdentify (server,password) |
151 |
| - return ircRaw(server,"PRIVMSG NickServ :IDENTIFY "..password) |
| 150 | +function func_ircIdentify (server,password,name) |
| 151 | + servers[server]["nickservname"] = name |
| 152 | + servers[server]["nickservpass"] = password |
| 153 | + if servers[server].connected then |
| 154 | + if name then |
| 155 | + return ircRaw(server,"PRIVMSG NickServ :IDENTIFY "..name.." "..password) |
| 156 | + else |
| 157 | + return ircRaw(server,"PRIVMSG NickServ :IDENTIFY "..password) |
| 158 | + end |
| 159 | + else |
| 160 | + return true |
| 161 | + end |
152 | 162 | end
|
153 |
| -registerFunction("ircIdentify","func_ircIdentify","irc-server","string") |
| 163 | +registerFunction("ircIdentify","func_ircIdentify","irc-server","string","(string)") |
154 | 164 |
|
155 | 165 | function func_ircConnect (host,nick,port,password,secure)
|
156 | 166 | local server = createElement("irc-server")
|
@@ -179,7 +189,6 @@ function func_ircReconnect (server,reason)
|
179 | 189 | sockClose(servers[server].socket)
|
180 | 190 | triggerEvent("onIRCConnecting",server)
|
181 | 191 | servers[server].connected = false
|
182 |
| - servers[server].connected = false |
183 | 192 | servers[server].socket = sockOpen(ircGetServerHost(server),ircGetServerPort(server),ircIsServerSecure(server))
|
184 | 193 | for i,channel in ipairs (ircGetServerChannels(server)) do
|
185 | 194 | ircRaw(server,"JOIN "..tostring(ircGetChannelName(channel)))
|
|
0 commit comments