beautify chan mode request with existed lib arch

ver3
acetone 2023-03-05 10:36:31 +03:00
parent e5cee8399e
commit 545484df6b
2 changed files with 4 additions and 25 deletions

View File

@ -299,9 +299,9 @@ void Network::RequestWhois(const QString &nick, Priority priority)
this->TransferRaw("WHOIS " + nick, priority);
}
void Network::RequestChannelList(const QString &channel, Priority priority)
void Network::RequestChannelMode(const QString &channel, Priority priority)
{
this->TransferRaw("LIST " + channel, priority);
this->TransferRaw("MODE " + channel, priority);
}
void Network::Identify(QString Nickname, QString Password, Priority priority)
@ -1161,9 +1161,6 @@ void Network::processIncomingRawData(QByteArray data)
case IRC_NUMERIC_RAW_INVITE:
emit this->Event_INVITE(&parser);
break;
case IRC_NUMERIC_LIST:
this->processChannelList(&parser);
break;
default:
known = false;
break;
@ -1640,7 +1637,7 @@ void Network::processJoin(Parser *parser, bool self_command)
this->channels.append(channel_p);
emit this->Event_SelfJoin(channel_p);
// to get channel mode flags
this->RequestChannelList(channel_name);
this->RequestChannelMode(channel_name);
}
}
if (!channel_p)
@ -1773,23 +1770,6 @@ void Network::processCap(Parser *parser)
emit this->Event_CAP(parser);
}
void Network::processChannelList(Parser *parser)
{
if (parser->GetParameters().size() < 2) return;
static QRegularExpression isModerated("^(\\[+[^\\s]*m[^\\s]*\\]|\\[-[^\\sm]*\\]).*$"); // m flag missing
if (not parser->GetText().contains(isModerated))
{
return;
}
auto* channel = this->GetChannel(parser->GetParameters().at(1));
if (channel == nullptr) return;
QString text = parser->GetText();
static QRegularExpression modePayload("\\].*$");
text.remove('[').remove(modePayload);
channel->SetMode(text);
}
void Network::processWhoisUser(Parser &parser)
{
libircclient::User user;

View File

@ -109,7 +109,7 @@ namespace libircclient
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 RequestChannelList(const QString& channel = "", Priority priority = Priority_Normal);
virtual void RequestChannelMode(const QString& channel, Priority priority = Priority_Normal);
virtual void Identify(QString Nickname = "", QString Password = "", Priority priority = Priority_Normal);
// IRCv3
virtual bool SupportsIRCv3() const;
@ -357,7 +357,6 @@ namespace libircclient
void processNick(Parser *parser, bool self_command);
void processAway(Parser *parser, bool self_command);
void processCap(Parser *parser);
void processChannelList(Parser *parser);
void processWhoisUser(Parser &parser);
void processWhoisIdle(Parser &parser);
void processChangeHost(Parser &parser);