changes and fix displayname of 'is live' message

This commit is contained in:
hemirt
2019-03-01 21:18:32 +01:00
parent ec6b26cd23
commit 3c01af9805
6 changed files with 43 additions and 7 deletions
+17 -5
View File
@@ -3,7 +3,7 @@
#include <QDebug>
#include "TwitchApi.hpp"
#include "common/Common.hpp"
#include "messages\Emote.hpp"
#include "messages/Emote.hpp"
#include "providers/bttv/BttvEmotes.hpp"
#include "providers/bttv/LoadBttvChannelEmote.hpp"
#include "singletons/Emotes.hpp"
@@ -15,19 +15,22 @@ ChatroomChannel::ChatroomChannel(const QString &channelName,
BttvEmotes &globalBttv, FfzEmotes &globalFfz)
: TwitchChannel(channelName, globalTwitchBadges, globalBttv, globalFfz)
{
auto list = channelName.split(":");
if (list.size() > 2)
auto listRef = channelName.splitRef(":");
if (listRef.size() > 2)
{
this->chatroomOwnerId = list[1];
this->chatroomOwnerId = listRef[1].toString();
}
}
void ChatroomChannel::refreshChannelEmotes()
{
if (this->chatroomOwnerId.isEmpty())
{
return;
}
TwitchApi::findUserName(
this->chatroomOwnerId,
[this, weak = weakOf<Channel>(this)](QString username) {
qDebug() << username;
BttvEmotes::loadChannel(username, [this, weak](auto &&emoteMap) {
if (auto shared = weak.lock())
this->bttvEmotes_.set(
@@ -38,7 +41,16 @@ void ChatroomChannel::refreshChannelEmotes()
this->ffzEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
});
if (auto shared = weak.lock())
{
this->chatroomOwnerName = username;
}
});
}
const QString &ChatroomChannel::getDisplayName() const
{
return this->chatroomOwnerName;
}
} // namespace chatterino