(irc) Faster readying of protocol
This commit is contained in:
parent
723d6c1950
commit
8ac73ca50e
|
@ -256,24 +256,9 @@ IrcProtocol::_ProcessNumeric(int32 numeric, BString sender, BStringList params)
|
||||||
ident << "@" << host;
|
ident << "@" << host;
|
||||||
|
|
||||||
// Contains the user's contact info― protocol ready!
|
// Contains the user's contact info― protocol ready!
|
||||||
if (fReady == false) {
|
if (fReady == false && nick == fNick) {
|
||||||
fUser = user.String();
|
fUser = user.String();
|
||||||
fIdent = ident;
|
_MakeReady(nick, ident);
|
||||||
|
|
||||||
fReady = true;
|
|
||||||
BMessage ready(IM_MESSAGE);
|
|
||||||
ready.AddInt32("im_what", IM_PROTOCOL_READY);
|
|
||||||
ready.PrintToStream();
|
|
||||||
_SendMsg(&ready);
|
|
||||||
|
|
||||||
BMessage self(IM_MESSAGE);
|
|
||||||
self.AddInt32("im_what", IM_OWN_CONTACT_INFO);
|
|
||||||
self.AddString("user_id", fIdent);
|
|
||||||
self.AddString("user_name", fNick);
|
|
||||||
self.PrintToStream();
|
|
||||||
_SendMsg(&self);
|
|
||||||
|
|
||||||
_SendIrc("MOTD\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to populate a room's userlist
|
// Used to populate a room's userlist
|
||||||
|
@ -344,6 +329,10 @@ void
|
||||||
IrcProtocol::_ProcessCommand(BString command, BString sender,
|
IrcProtocol::_ProcessCommand(BString command, BString sender,
|
||||||
BStringList params)
|
BStringList params)
|
||||||
{
|
{
|
||||||
|
// If protocol uninitialized and the user's ident is mentioned― use it!
|
||||||
|
if (fReady == false && _SenderNick(sender) == fNick)
|
||||||
|
_MakeReady(_SenderNick(sender), _SenderIdent(sender));
|
||||||
|
|
||||||
if (command == "PING")
|
if (command == "PING")
|
||||||
{
|
{
|
||||||
BString cmd = "PONG ";
|
BString cmd = "PONG ";
|
||||||
|
@ -441,6 +430,29 @@ IrcProtocol::_ProcessCommand(BString command, BString sender,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IrcProtocol::_MakeReady(BString nick, BString ident)
|
||||||
|
{
|
||||||
|
fNick = nick;
|
||||||
|
fIdent = ident;
|
||||||
|
|
||||||
|
fReady = true;
|
||||||
|
BMessage ready(IM_MESSAGE);
|
||||||
|
ready.AddInt32("im_what", IM_PROTOCOL_READY);
|
||||||
|
ready.PrintToStream();
|
||||||
|
_SendMsg(&ready);
|
||||||
|
|
||||||
|
BMessage self(IM_MESSAGE);
|
||||||
|
self.AddInt32("im_what", IM_OWN_CONTACT_INFO);
|
||||||
|
self.AddString("user_id", fIdent);
|
||||||
|
self.AddString("user_name", fNick);
|
||||||
|
self.PrintToStream();
|
||||||
|
_SendMsg(&self);
|
||||||
|
|
||||||
|
_SendIrc("MOTD\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BString
|
BString
|
||||||
IrcProtocol::_LineSender(BStringList words)
|
IrcProtocol::_LineSender(BStringList words)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,8 @@ private:
|
||||||
void _ProcessCommand(BString command, BString sender,
|
void _ProcessCommand(BString command, BString sender,
|
||||||
BStringList params);
|
BStringList params);
|
||||||
|
|
||||||
|
void _MakeReady(BString nick, BString ident);
|
||||||
|
|
||||||
BString _LineSender(BStringList words);
|
BString _LineSender(BStringList words);
|
||||||
BString _LineCode(BStringList words);
|
BString _LineCode(BStringList words);
|
||||||
BStringList _LineParameters(BStringList words, BString line);
|
BStringList _LineParameters(BStringList words, BString line);
|
||||||
|
|
Ŝarĝante…
Reference in New Issue