From: Shane Synan Date: Fri, 20 May 2016 22:26:11 +0000 (-0400) Subject: Add support for chghost X-Git-Tag: travis-deploy-test~470^2~4 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=bd3c5592e03480b17087abe44ae96048e0ab2e74 Add support for chghost Add support for chghost to be notified of user/hostmask changes. On newer servers, this should fix all cases of outdated information resulting from away-notify disabling WHO polling. See http://ircv3.net/specs/extensions/chghost-3.2.html --- diff --git a/src/common/eventmanager.h b/src/common/eventmanager.h index 37017430..2d88143a 100644 --- a/src/common/eventmanager.h +++ b/src/common/eventmanager.h @@ -91,6 +91,7 @@ public : IrcEventAccount, IrcEventAway, IrcEventCap, + IrcEventChghost, IrcEventInvite, IrcEventJoin, IrcEventKick, diff --git a/src/common/irccap.h b/src/common/irccap.h index 3398adab..61dac32c 100644 --- a/src/common/irccap.h +++ b/src/common/irccap.h @@ -58,6 +58,13 @@ namespace IrcCap { */ const QString CAP_NOTIFY = "cap-notify"; + /** + * Hostname/user changed notification. + * + * http://ircv3.net/specs/extensions/chghost-3.2.html + */ + const QString CHGHOST = "chghost"; + /** * Extended join information. * @@ -93,6 +100,7 @@ namespace IrcCap { ACCOUNT_NOTIFY, AWAY_NOTIFY, CAP_NOTIFY, + CHGHOST, EXTENDED_JOIN, MULTI_PREFIX, SASL, diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index ade8c3bd..fd8a97c5 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -277,6 +277,23 @@ void CoreSessionEventProcessor::processIrcEventAway(IrcEvent *e) } } +/* IRCv3 chghost - ":nick!user@host CHGHOST newuser new.host.goes.here" */ +void CoreSessionEventProcessor::processIrcEventChghost(IrcEvent *e) +{ + if (!checkParamCount(e, 2)) + return; + + IrcUser *ircuser = e->network()->updateNickFromMask(e->prefix()); + if (ircuser) { + // Update with new user/hostname information. setUser/setHost handles checking what + // actually changed. + ircuser->setUser(e->params().at(0)); + ircuser->setHost(e->params().at(1)); + } else { + qDebug() << "Received chghost data for unknown user" << e->prefix(); + } +} + void CoreSessionEventProcessor::processIrcEventInvite(IrcEvent *e) { if (checkParamCount(e, 2)) { diff --git a/src/core/coresessioneventprocessor.h b/src/core/coresessioneventprocessor.h index ff167299..56124242 100644 --- a/src/core/coresessioneventprocessor.h +++ b/src/core/coresessioneventprocessor.h @@ -50,6 +50,7 @@ public: Q_INVOKABLE void processIrcEventCap(IrcEvent *event); /// CAP framework negotiation Q_INVOKABLE void processIrcEventAccount(IrcEvent *event); /// account-notify received Q_INVOKABLE void processIrcEventAway(IrcEvent *event); /// away-notify received + Q_INVOKABLE void processIrcEventChghost(IrcEvent *event); /// chghost received Q_INVOKABLE void processIrcEventInvite(IrcEvent *event); Q_INVOKABLE void processIrcEventJoin(IrcEvent *event); Q_INVOKABLE void lateProcessIrcEventKick(IrcEvent *event);