+void IrcChannel::removeChannelMode(const QChar &mode, const QString &value) {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::NOT_A_CHANMODE:
+ return;
+ case Network::A_CHANMODE:
+ if(_A_channelModes.contains(mode))
+ _A_channelModes[mode].removeAll(value);
+ break;
+
+ case Network::B_CHANMODE:
+ _B_channelModes.remove(mode);
+ break;
+
+ case Network::C_CHANMODE:
+ _C_channelModes.remove(mode);
+ break;
+
+ case Network::D_CHANMODE:
+ _D_channelModes.remove(mode);
+ break;
+ }
+ emit channelModeRemoved(mode, value);
+}
+
+bool IrcChannel::hasMode(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::NOT_A_CHANMODE:
+ return false;
+ case Network::A_CHANMODE:
+ return _A_channelModes.contains(mode);
+ case Network::B_CHANMODE:
+ return _B_channelModes.contains(mode);
+ case Network::C_CHANMODE:
+ return _C_channelModes.contains(mode);
+ case Network::D_CHANMODE:
+ return _D_channelModes.contains(mode);
+ default:
+ return false;
+ }
+}
+
+QString IrcChannel::modeValue(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::B_CHANMODE:
+ if(_B_channelModes.contains(mode))
+ return _B_channelModes[mode];
+ else
+ return QString();
+ case Network::C_CHANMODE:
+ if(_C_channelModes.contains(mode))
+ return _C_channelModes[mode];
+ else
+ return QString();
+ default:
+ return QString();
+ }
+
+}
+
+QStringList IrcChannel::modeValueList(const QChar &mode) const {
+ Network::ChannelModeType modeType = network->channelModeType(mode);
+
+ switch(modeType) {
+ case Network::A_CHANMODE:
+ if(_A_channelModes.contains(mode))
+ return _A_channelModes[mode];
+ default:
+ return QStringList();
+ }
+}
+
+QString IrcChannel::channelModeString() const {
+ QStringList params;
+ QString modeString;
+
+ QSet<QChar>::const_iterator D_iter = _D_channelModes.constBegin();
+ while(D_iter != _D_channelModes.constEnd()) {
+ modeString += *D_iter;
+ D_iter++;
+ }
+
+ QHash<QChar, QString>::const_iterator BC_iter = _C_channelModes.constBegin();
+ while(BC_iter != _C_channelModes.constEnd()) {
+ modeString += BC_iter.key();
+ params << BC_iter.value();
+ BC_iter++;
+ }
+
+ BC_iter = _B_channelModes.constBegin();
+ while(BC_iter != _B_channelModes.constEnd()) {
+ modeString += BC_iter.key();
+ params << BC_iter.value();
+ BC_iter++;
+ }
+ if(modeString.isEmpty())
+ return modeString;
+ else
+ return QString("+%1 %2").arg(modeString).arg(params.join(" "));
+}