Add remaining pubsub messages to chat

This commit is contained in:
Rasmus Karlsson
2018-04-29 13:24:37 +02:00
parent d05a59ef51
commit e31dc09e91
4 changed files with 93 additions and 12 deletions
@@ -212,6 +212,7 @@ void IrcMessageHandler::handleModeMessage(Communi::IrcMessage *message)
void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
{
return;
auto app = getApp();
MessagePtr msg = Message::createSystemMessage(message->content());
+31 -1
View File
@@ -226,7 +226,7 @@ PubSub::PubSub()
bool ok;
action.args.duration = QString(durationArg.GetString()).toUInt(&ok, 10);
action.duration = QString(durationArg.GetString()).toUInt(&ok, 10);
this->sig.moderation.modeChanged.invoke(action);
};
@@ -290,6 +290,21 @@ PubSub::PubSub()
ModerationStateAction action(data, roomID);
getTargetUser(data, action.target);
try {
const auto &args = getArgs(data);
if (args.Size() < 1) {
return;
}
if (!rj::getSafe(args[0], action.target.name)) {
return;
}
} catch (const std::runtime_error &ex) {
debug::Log("Error parsing moderation action: {}", ex.what());
}
action.modded = false;
this->sig.moderation.moderationStateChanged.invoke(action);
@@ -299,6 +314,21 @@ PubSub::PubSub()
ModerationStateAction action(data, roomID);
getTargetUser(data, action.target);
try {
const auto &args = getArgs(data);
if (args.Size() < 1) {
return;
}
if (!rj::getSafe(args[0], action.target.name)) {
return;
}
} catch (const std::runtime_error &ex) {
debug::Log("Error parsing moderation action: {}", ex.what());
}
action.modded = true;
this->sig.moderation.moderationStateChanged.invoke(action);
+17 -3
View File
@@ -41,9 +41,23 @@ struct ModeChangedAction : PubSubAction {
On,
} state;
union {
uint32_t duration;
} args;
uint32_t duration = 0;
const char *getModeName() const
{
switch (this->mode) {
case Mode::Slow:
return "slow";
case Mode::R9K:
return "r9k";
case Mode::SubscribersOnly:
return "subscribers-only";
case Mode::EmoteOnly:
return "emote-only";
default:
return "unknown";
}
}
};
struct BanAction : PubSubAction {