X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fnetwork.h;h=38e1883c3d2e9627a1778a454294692003134fb1;hb=b12b02f1bd5ee8a68bda20622b7ec3eac84f000c;hp=5ad42e9f1a3ffec70ca32775c57b79cfbf14d5a6;hpb=b2c3e61e5888741644b24f5b3701a6311ec631dd;p=quassel.git diff --git a/src/common/network.h b/src/common/network.h index 5ad42e9f..38e1883c 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -172,10 +172,37 @@ public : //Network::ConnectionState connectionState() const; inline int connectionState() const { return _connectionState; } + /**@{*/ + /** + * Translates a user’s prefix to the channelmode associated with it. + * @param prefix Prefix to be translated. + */ QString prefixToMode(const QString &prefix) const; inline QString prefixToMode(const QCharRef &prefix) const { return prefixToMode(QString(prefix)); } + inline QString prefixesToModes(const QString &prefix) const { + QString modes; + for (QChar c : prefix) { + modes += prefixToMode(c); + } + return modes; + } + /**@}*/ + + /**@{*/ + /** + * Translates a user’s prefix to the channelmode associated with it. + * @param prefix Prefix to be translated. + */ QString modeToPrefix(const QString &mode) const; inline QString modeToPrefix(const QCharRef &mode) const { return modeToPrefix(QString(mode)); } + inline QString modesToPrefixes(const QString &mode) const { + QString prefixes; + for (QChar c : mode) { + prefixes += modeToPrefix(c); + } + return prefixes; + } + /**@}*/ ChannelModeType channelModeType(const QString &mode); inline ChannelModeType channelModeType(const QCharRef &mode) { return channelModeType(QString(mode)); } @@ -268,7 +295,7 @@ public : * * These results aren't valid if the network is disconnected or capability negotiation hasn't * happened, and some servers might not correctly advertise capabilities. Don't treat this as - * a guarentee. + * a guarantee. * * @param[in] capability Name of capability * @returns True if connected and advertised by the server, otherwise false