mIRC Home    About    Download    Register    News    Help

Print Thread
Error 401 caused by ON CONNECT script #195974 07/03/08 09:44 AM
Joined: Nov 2004
Posts: 22
G
gencha Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2004
Posts: 22
Hi,
i am currently trying to implement a system to run commands when a user connects to a certain irc network. Very similar to the perform list feature in mIRC itself.

So i place my code in an ON CONNECT event naturally. In my test setup i only send a NICK and a JOIN command.

Now, in the case that before i connect, i set my nickname to a different nickname than the one in the script, this will result in an "No such nick/channel" error after connecting.

Let me show you a log of the connect process:
Quote:
-> localhost NICK n
-> localhost USER user "server.com" "localhost" :Full Name
<- :irc.foonet.com NOTICE AUTH :*** Looking up your hostname...
<- :irc.foonet.com NOTICE AUTH :*** Found your hostname (cached)
<- PING :313D5714
-> localhost PONG :313D5714
<- :irc.foonet.com 001 n :Welcome to the ROXnet IRC Network n!user@localhost
-> irc.foonet.com USERHOST n
<- :irc.foonet.com 002 n :Your host is irc.foonet.com, running version Unreal3.2.7
<- :irc.foonet.com 003 n :This server was created Fri Jul 13 19:22:25 2007
<- :irc.foonet.com 004 n irc.foonet.com Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
<- :irc.foonet.com 005 n NAMESX SAFELIST HCN MAXCHANNELS=10 CHANLIMIT=#:10 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 WALLCHOPS :are supported by this server
<- :irc.foonet.com 005 n WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK=ROXnet CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS INVEX :are supported by this server
<- :irc.foonet.com 005 n CMDS=KNOCK,MAP,DCCALLOW,USERIP :are supported by this server
<- :irc.foonet.com 251 n :There are 1 users and 7 invisible on 1 servers
<- :irc.foonet.com 254 n 1 :channels formed
<- :irc.foonet.com 255 n :I have 8 clients and 0 servers
<- :irc.foonet.com 265 n :Current Local Users: 8 Max: 9
<- :irc.foonet.com 266 n :Current Global Users: 8 Max: 9
<- :irc.foonet.com 422 n :MOTD File is missing
<- :n MODE n :+iwx
<- :irc.foonet.com 302 n :n=+user@localhost
-> irc.foonet.com NICK :nickname
-> irc.foonet.com JOIN #mirc
-> irc.foonet.com MODE n +i
-> irc.foonet.com PROTOCTL NAMESX
-> irc.foonet.com JOIN #mirc
<- :n!user@rox-485150F5 NICK :nickname
<- :nickname!user@rox-485150F5 JOIN :#mirc
-> irc.foonet.com MODE #mirc
<- :irc.foonet.com 353 nickname = #mirc :nickname @nick7 @nick6 @nick5 @nick4 @nick3 @nick2 @nick1
<- :irc.foonet.com 366 nickname #mirc :End of /NAMES list.
<- :irc.foonet.com 401 nickname n :No such nick/channel


In this connect process the original nick was "n" and the nickname set in the script was "nickname".

Looking at that log, the problem becomes obvious. mIRC sends the MODE +i (set was requested in the options dialog) after the ON CONNECT event is triggered.

Any suggestions on how to fix this, that don't include /timer workarounds, are much appreciated.

Thanks in advance

Re: Error 401 caused by ON CONNECT script [Re: gencha] #195977 07/03/08 11:49 AM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
I've confirmed this. Should be logged as a bug.

Vanilla 6.31 on XP, the inbuilt "Invisible mode" option gets sent after the ON CONNECT has begun, thus allowing for this sort of issue.

Yes, it's minor, but should be addressed.

The "Invisible mode" option should send it's command prior to triggering ON CONNECT in my opinion.

Re: Error 401 caused by ON CONNECT script [Re: Bekar] #196079 09/03/08 02:40 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
I think you need to look up how one logs onto a server. The server isn't going to let you change your nick immediately after a successful connection.

mIRC allows multiple server connections, but only has one server setting. There needs to be a different setting for nick, etc for each network.


Beware of MeStinkBAD! He knows more than he actually does!
Re: Error 401 caused by ON CONNECT script [Re: MeStinkBAD] #196080 09/03/08 02:47 AM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Umm, the ON CONNECT doesn't trigger at the TCP socket connection, but after it's done the USER and the initial NICK.

One assumes that all the automated 'server' settings should be finished prior to being able to change values that they rely upon.