Fix whisper receiving
Added setting to display them inline under "Special Channels" page Store a twitch users color in the TwitchUser struct this is useful if we ever want to use the users own color. The users own color is only updated once he has written once in chat Add helper method for calling function only on normal channels Fixes #54
This commit is contained in:
@@ -138,5 +138,12 @@ void ChannelManager::doOnAll(std::function<void(ChannelPtr)> func)
|
||||
func(this->mentionsChannel);
|
||||
}
|
||||
|
||||
void ChannelManager::doOnAllNormalChannels(std::function<void(ChannelPtr)> func)
|
||||
{
|
||||
for (const auto &channel : this->twitchChannels) {
|
||||
func(std::get<0>(channel));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
const std::string &getUserID(const std::string &username);
|
||||
|
||||
void doOnAll(std::function<void(ChannelPtr)> func);
|
||||
void doOnAllNormalChannels(std::function<void(ChannelPtr)> func);
|
||||
|
||||
// Special channels
|
||||
const ChannelPtr whispersChannel;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "singletons/resourcemanager.hpp"
|
||||
#include "singletons/windowmanager.hpp"
|
||||
#include "twitch/twitchchannel.hpp"
|
||||
#include "twitch/twitchmessagebuilder.hpp"
|
||||
|
||||
using namespace chatterino::messages;
|
||||
|
||||
@@ -139,7 +140,29 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
|
||||
|
||||
void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
|
||||
{
|
||||
// TODO: Implement
|
||||
debug::Log("Received whisper!");
|
||||
messages::MessageParseArgs args;
|
||||
|
||||
args.isReceivedWhisper = true;
|
||||
|
||||
auto c = this->channelManager.whispersChannel.get();
|
||||
|
||||
twitch::TwitchMessageBuilder builder(c, message, message->parameter(1), args);
|
||||
|
||||
if (!builder.isIgnored()) {
|
||||
messages::MessagePtr _message = builder.build();
|
||||
if (_message->flags & messages::Message::Highlighted) {
|
||||
singletons::ChannelManager::getInstance().mentionsChannel->addMessage(_message);
|
||||
}
|
||||
|
||||
c->addMessage(_message);
|
||||
|
||||
if (SettingManager::getInstance().inlineWhispers) {
|
||||
this->channelManager.doOnAllNormalChannels([_message](ChannelPtr channel) {
|
||||
channel->addMessage(_message); //
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message)
|
||||
@@ -202,6 +225,7 @@ void IrcMessageHandler::handleWriteConnectionNoticeMessage(Communi::IrcNoticeMes
|
||||
|
||||
this->handleNoticeMessage(message);
|
||||
}
|
||||
|
||||
} // namespace helper
|
||||
} // namespace singletons
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
void handleNoticeMessage(Communi::IrcNoticeMessage *message);
|
||||
void handleWriteConnectionNoticeMessage(Communi::IrcNoticeMessage *message);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace helper
|
||||
} // namespace singletons
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user