fix some clang warns & requestWhois

ver3
acetone 2023-03-04 15:05:56 +03:00
parent ca9e459dc1
commit 549d68b10a
2 changed files with 23 additions and 17 deletions

View File

@ -289,6 +289,11 @@ void Network::RequestNick(const QString &nick, Priority priority)
this->TransferRaw("NICK " + nick, priority);
}
void Network::RequestWhois(const QString &nick, Priority priority)
{
this->TransferRaw("WHOIS " + nick, priority);
}
void Network::Identify(QString Nickname, QString Password, Priority priority)
{
if (Nickname.isEmpty())
@ -878,14 +883,14 @@ void Network::processIncomingRawData(QByteArray data)
if (parser.GetParameters().count() == 0)
this->TransferRaw("PONG", Priority_RealTime);
else
this->TransferRaw("PONG :" + parser.GetParameters()[0], Priority_RealTime);
this->TransferRaw("PONG :" + parser.GetParameters().first(), Priority_RealTime);
break;
case IRC_NUMERIC_MYINFO:
// Process the information about network
if (parser.GetParameters().count() < 4)
break;
this->server->SetName(parser.GetParameters()[1]);
this->server->SetVersion(parser.GetParameters()[2]);
this->server->SetName(parser.GetParameters().at(1));
this->server->SetVersion(parser.GetParameters().at(2));
this->ChannelModeHelp = NetworkModeHelp::GetChannelModeHelp(this->server->GetVersion());
this->UserModeHelp = NetworkModeHelp::GetUserModeHelp(this->server->GetVersion());
this->autoJoin();
@ -928,7 +933,7 @@ void Network::processIncomingRawData(QByteArray data)
qDebug() << "IRC PARSER: Invalid PART: " + parser.GetRaw();
break;
}
Channel *channel = this->GetChannel(parser.GetParameters()[0]);
Channel *channel = this->GetChannel(parser.GetParameters().first());
if (self_command)
{
if (!channel)
@ -1046,7 +1051,7 @@ void Network::processIncomingRawData(QByteArray data)
qDebug() << "IRC PARSER: Invalid TOPICINFO: " + parser.GetRaw();
break;
}
Channel *channel = this->GetChannel(parser.GetParameters()[1]);
Channel *channel = this->GetChannel(parser.GetParameters().at(1));
if (!channel)
{
emit this->Event_Broken(&parser, "Channel struct not in memory");
@ -1165,7 +1170,7 @@ void Network::processNamrpl(Parser *parser)
return;
}
Channel *channel = this->GetChannel(parser->GetParameters()[2]);
Channel *channel = this->GetChannel(parser->GetParameters().at(2));
if (channel == NULL)
{
emit this->Event_Broken(parser, "Channel struct not in memory");
@ -1359,7 +1364,7 @@ void Network::processTopic(Parser *parser)
qDebug() << "IRC PARSER: Invalid TOPIC: " + parser->GetRaw();
return;
}
Channel *channel = this->GetChannel(parser->GetParameters()[0]);
Channel *channel = this->GetChannel(parser->GetParameters().first());
if (!channel)
{
emit this->Event_Broken(parser, "Channel struct not in memory");
@ -1377,8 +1382,8 @@ void Network::processKick(Parser *parser)
qDebug() << "IRC PARSER: Invalid KICK: " + parser->GetRaw();
return;
}
bool self_command = parser->GetParameters()[1].toLower() == this->GetNick().toLower();
Channel *channel = this->GetChannel(parser->GetParameters()[0]);
bool self_command = parser->GetParameters().at(1).toLower() == this->GetNick().toLower();
Channel *channel = this->GetChannel(parser->GetParameters().first());
if (self_command)
{
if (!channel)
@ -1396,7 +1401,7 @@ void Network::processKick(Parser *parser)
}
else if (channel)
{
channel->RemoveUser(parser->GetParameters()[1]);
channel->RemoveUser(parser->GetParameters().at(1));
}
emit this->Event_Kick(parser, channel);
}
@ -1431,7 +1436,7 @@ void Network::processPMode(Parser *parser, char mode)
emit this->Event_Broken(parser, "Invalid PMODE");
return;
}
libircclient::Channel *channel = this->GetChannel(parameters[1]);
libircclient::Channel *channel = this->GetChannel(parameters.at(1));
if (!channel)
{
emit this->Event_Broken(parser, "Unknown channel");
@ -1454,13 +1459,13 @@ void Network::processMode(Parser *parser)
emit this->Event_Broken(parser, "Invalid mode");
return;
}
QString entity = parser->GetParameters()[0];
QString entity = parser->GetParameters().at(0);
if (entity.toLower() == this->localUser.GetNick().toLower())
{
// Someone changed our own UMode
QString mode = parser->GetText();
if (mode.isEmpty() && parser->GetParameters().count() > 1)
mode = parser->GetParameters()[1];
mode = parser->GetParameters().at(1);
this->localUserMode.SetMode(mode);
} else if (entity.startsWith(this->channelPrefix))
{
@ -1602,7 +1607,7 @@ void Network::processJoin(Parser *parser, bool self_command)
// we don't need to do this if we are using IRCv.3 protocol
QString channel_name = parser->GetText();
if (parser->GetParameters().count() > 0)
channel_name = parser->GetParameters()[0];
channel_name = parser->GetParameters().first();
if (!channel_name.startsWith(this->channelPrefix))
{
emit this->Event_Broken(parser, "Malformed JOIN");
@ -1659,7 +1664,7 @@ void Network::processNick(Parser *parser, bool self_command)
}
else
{
new_nick = parser->GetParameters()[0];
new_nick = parser->GetParameters().first();
}
// Precache the nicks to save hundreds of function calls
QString old_nick = parser->GetSourceUserInfo()->GetNick();
@ -1796,8 +1801,8 @@ void Network::processChangeHost(Parser &parser)
return;
}
new_ident = parser.GetParameters()[0];
new_host = parser.GetParameters()[1];
new_ident = parser.GetParameters().first();
new_host = parser.GetParameters().at(1);
old_ident = parser.GetSourceUserInfo()->GetIdent();
old_host = parser.GetSourceUserInfo()->GetHost();
nick = parser.GetSourceUserInfo()->GetNick();

View File

@ -107,6 +107,7 @@ namespace libircclient
virtual void RequestPart(const QString &channel_name, Priority priority = Priority_Normal);
virtual void RequestPart(Channel *channel, Priority priority = Priority_Normal);
virtual void RequestNick(const QString &nick, Priority priority = Priority_Normal);
virtual void RequestWhois(const QString& nick, Priority priority = Priority_Normal);
virtual void Identify(QString Nickname = "", QString Password = "", Priority priority = Priority_Normal);
// IRCv3
virtual bool SupportsIRCv3() const;