19 #include <QElapsedTimer> 20 #include <QRegularExpression> 21 #include <boost/optional.hpp> 22 #include <boost/signals2.hpp> 23 #include <pajlada/signals/signalholder.hpp> 27 #include <unordered_map> 38 const QChar ESCAPE_TAG_CHARS[2] = {QChar::highSurrogate(0xE0002),
39 QChar::lowSurrogate(0xE0002)};
43 const static QRegularExpression COMBINED_FIXER(
44 QString(
"(?<!%1)%1").arg(ESCAPE_TAG),
45 QRegularExpression::UseUnicodePropertiesOption);
50 using EmotePtr = std::shared_ptr<const Emote>;
78 int followerOnly = -1;
87 virtual bool isEmpty()
const override;
89 virtual void sendMessage(
const QString &message)
override;
90 virtual void sendReply(
const QString &message,
const QString &replyId);
91 virtual bool isMod()
const override;
106 virtual bool isLive()
const override;
112 boost::optional<EmotePtr>
bttvEmote(
const EmoteName &
name)
const;
113 boost::optional<EmotePtr>
ffzEmote(
const EmoteName &
name)
const;
115 std::shared_ptr<const EmoteMap>
bttvEmotes()
const;
116 std::shared_ptr<const EmoteMap>
ffzEmotes()
const;
138 const QString &newEmoteSetID);
143 boost::optional<EmotePtr>
twitchBadge(
const QString &
set,
144 const QString &version)
const;
147 boost::optional<CheerEmote>
cheerEmote(
const QString &
string);
156 void addReplyThread(
const std::shared_ptr<MessageThread> &thread);
157 const std::unordered_map<QString, std::weak_ptr<MessageThread>> &
threads()
167 pajlada::Signals::SelfDisconnectingSignal<ChannelPointReward>
172 const QString &rewardId)
const;
177 QString localizedName;
182 void refreshLiveStatus();
184 void refreshPubSub();
185 void refreshChatters();
186 void refreshBadges();
187 void refreshCheerEmotes();
188 void loadRecentMessages();
189 void loadRecentMessagesReconnect();
190 void fetchDisplayName();
191 void cleanUpReplyThreads();
192 void showLoginMessage();
194 void setLive(
bool newLiveStatus);
195 void setMod(
bool value);
196 void setVIP(
bool value);
197 void setStaff(
bool value);
198 void setRoomId(
const QString &
id);
199 void setRoomModes(
const RoomModes &roomModes_);
200 void setDisplayName(
const QString &
name);
201 void setLocalizedName(
const QString &
name);
203 const QString &getDisplayName()
const override;
204 const QString &getLocalizedName()
const override;
206 QString prepareMessage(
const QString &message)
const;
218 void addOrReplaceLiveUpdatesAddRemove(
bool isEmoteAdd,
219 const QString &platform,
220 const QString &actor,
221 const QString &emoteName);
238 bool tryReplaceLastLiveUpdateAddOrRemove(
MessageFlag op,
239 const QString &platform,
240 const QString &actor,
241 const QString &emoteName);
244 const QString subscriptionUrl_;
245 const QString channelUrl_;
246 const QString popoutPlayerUrl_;
250 std::atomic_flag loadingRecentMessages_ = ATOMIC_FLAG_INIT;
251 std::unordered_map<QString, std::weak_ptr<MessageThread>> threads_;
273 QString lastSentMessage_;
274 QObject lifetimeGuard_;
275 QTimer chattersListTimer_;
276 QTimer threadClearTimer_;
277 QElapsedTimer titleRefreshedTimer_;
278 QElapsedTimer clipCreationTimer_;
279 bool isClipCreationInProgress{
false};
285 QString seventvUserID_;
290 QString seventvEmoteSetID_;
295 size_t seventvUserTwitchConnectionIndex_;
298 QString lastLiveUpdateEmotePlatform_;
300 QString lastLiveUpdateEmoteActor_;
302 std::weak_ptr<const Message> lastLiveUpdateMessage_;
304 std::vector<QString> lastLiveUpdateEmoteNames_;
306 pajlada::Signals::SignalHolder signalHolder_;
307 std::vector<boost::signals2::scoped_connection> bSignals_;
QString game
Definition: TwitchChannel.hpp:68
std::shared_ptr< const EmoteMap > bttvEmotes() const
Definition: TwitchChannel.cpp:588
QString title
Definition: TwitchChannel.hpp:67
Definition: BttvEmotes.hpp:15
QString emoteOnly(const CommandContext &ctx)
Definition: ChatSettings.cpp:100
const QString & channelUrl()
Definition: TwitchChannel.cpp:805
std::shared_ptr< const EmoteMap > ffzEmotes() const
Definition: TwitchChannel.cpp:593
Definition: TwitchChannel.hpp:63
virtual bool isLive() const override
Definition: TwitchChannel.cpp:544
std::shared_ptr< const EmoteMap > seventvEmotes() const
Definition: TwitchChannel.cpp:598
Definition: TwitchChannel.hpp:60
Atomic< boost::optional< EmotePtr > > ffzCustomModBadge_
Definition: TwitchChannel.hpp:257
void addChannelPointReward(const ChannelPointReward &reward)
Definition: TwitchChannel.cpp:261
unsigned viewerCount
Definition: TwitchChannel.hpp:66
Definition: UniqueAccess.hpp:10
void addReplyThread(const std::shared_ptr< MessageThread > &thread)
Definition: TwitchChannel.cpp:1161
Definition: TwitchBadges.hpp:27
pajlada::Signals::NoArgSignal roomIdChanged
Definition: TwitchChannel.hpp:161
QString streamType
Definition: TwitchChannel.hpp:71
bool isChannelPointRewardKnown(const QString &rewardId)
Definition: TwitchChannel.cpp:289
Definition: Application.cpp:48
Definition: SeventvEventAPIDispatch.hpp:21
boost::optional< ChannelPointReward > channelPointReward(const QString &rewardId) const
Definition: TwitchChannel.cpp:296
Atomic< std::shared_ptr< const EmoteMap > > ffzEmotes_
Definition: TwitchChannel.hpp:255
virtual void sendMessage(const QString &message) override
Definition: TwitchChannel.cpp:382
const QString ESCAPE_TAG
Definition: TwitchChannel.hpp:41
Definition: TwitchMessageBuilder.hpp:37
pajlada::Signals::SelfDisconnectingSignal< ChannelPointReward > channelPointRewardAdded
Definition: TwitchChannel.hpp:168
pajlada::Signals::NoArgSignal userStateChanged
Definition: TwitchChannel.hpp:162
virtual bool canSendMessage() const override
Definition: TwitchChannel.cpp:163
boost::optional< EmotePtr > ffzCustomModBadge() const
Definition: TwitchChannel.cpp:1448
boost::optional< CheerEmote > cheerEmote(const QString &string)
Definition: TwitchChannel.cpp:1458
HighlightState
Definition: Common.hpp:16
Definition: SeventvEmotes.hpp:57
std::shared_ptr< const Emote > EmotePtr
Definition: Emote.hpp:38
const QString & seventvEmoteSetID() const
Definition: TwitchChannel.cpp:607
boost::optional< EmotePtr > twitchBadge(const QString &set, const QString &version) const
Definition: TwitchChannel.cpp:1432
void initialize()
Definition: TwitchChannel.cpp:151
boost::optional< EmotePtr > ffzCustomVipBadge() const
Definition: TwitchChannel.cpp:1453
Definition: TwitchChannel.hpp:74
Definition: UniqueAccess.hpp:53
virtual void refreshFFZChannelEmotes(bool manualRefresh)
Definition: TwitchChannel.cpp:206
Definition: FfzEmotes.hpp:15
MessageFlag
Definition: Message.hpp:18
pajlada::Signals::NoArgSignal liveStatusChanged
Definition: TwitchChannel.hpp:163
Definition: SeventvEventAPIDispatch.hpp:45
Definition: Channel.hpp:30
const std::unordered_map< QString, std::weak_ptr< MessageThread > > & threads() const
Definition: TwitchChannel.cpp:1167
virtual bool canReconnect() const override
Definition: TwitchChannel.cpp:506
const QString & subscriptionUrl()
Definition: TwitchChannel.cpp:800
boost::optional< EmotePtr > bttvEmote(const EmoteName &name) const
Definition: TwitchChannel.cpp:555
TwitchChannel(const QString &channelName)
Definition: TwitchChannel.cpp:57
virtual void reconnect() override
Definition: TwitchChannel.cpp:511
bool rerun
Definition: TwitchChannel.hpp:65
const QString & seventvUserID() const
Definition: TwitchChannel.cpp:603
virtual void refreshBTTVChannelEmotes(bool manualRefresh)
Definition: TwitchChannel.cpp:188
virtual void sendReply(const QString &message, const QString &replyId)
Definition: TwitchChannel.cpp:415
Definition: ChannelChatters.hpp:13
bool isVip() const
Definition: TwitchChannel.cpp:454
Definition: ChannelPointReward.hpp:14
virtual bool isMod() const override
Definition: TwitchChannel.cpp:449
bool isStaff() const
Definition: TwitchChannel.cpp:459
bool live
Definition: TwitchChannel.hpp:64
void addSeventvEmote(const SeventvEventAPIEmoteAddDispatch &dispatch)
Definition: TwitchChannel.cpp:612
Definition: TwitchIrcServer.hpp:24
SharedAccessGuard< const StreamStatus > accessStreamStatus() const
Definition: TwitchChannel.cpp:550
virtual bool isBroadcaster() const override
Definition: TwitchChannel.cpp:494
QString roomId() const
Definition: TwitchChannel.cpp:516
void updateSeventvUser(const SeventvEventAPIUserConnectionUpdateDispatch &dispatch)
Definition: TwitchChannel.cpp:651
Definition: SeventvEventAPIDispatch.hpp:58
QString name
Definition: Credentials.cpp:94
pajlada::Signals::NoArgSignal roomModesChanged
Definition: TwitchChannel.hpp:164
boost::optional< EmotePtr > ffzEmote(const EmoteName &name) const
Definition: TwitchChannel.cpp:565
virtual void refreshSevenTVChannelEmotes(bool manualRefresh)
Definition: TwitchChannel.cpp:236
const QString ZERO_WIDTH_JOINER
Definition: TwitchChannel.hpp:34
Definition: IrcMessageHandler.hpp:16
SharedAccessGuard< const RoomModes > accessRoomModes() const
Definition: TwitchChannel.cpp:532
void refreshTitle()
Definition: TwitchChannel.cpp:906
QString uptime
Definition: TwitchChannel.hpp:70
void updateSeventvData(const QString &newUserID, const QString &newEmoteSetID)
Definition: TwitchChannel.cpp:690
void updateSeventvEmote(const SeventvEventAPIEmoteUpdateDispatch &dispatch)
Definition: TwitchChannel.cpp:624
void removeSeventvEmote(const SeventvEventAPIEmoteRemoveDispatch &dispatch)
Definition: TwitchChannel.cpp:638
int chatterCount()
Definition: TwitchChannel.cpp:815
virtual bool isEmpty() const override
Definition: TwitchChannel.cpp:158
void createClip()
Definition: TwitchChannel.cpp:1319
Atomic< boost::optional< EmotePtr > > ffzCustomVipBadge_
Definition: TwitchChannel.hpp:258
QString gameId
Definition: TwitchChannel.hpp:69
virtual bool hasHighRateLimit() const override
Definition: TwitchChannel.cpp:501
const QString & popoutPlayerUrl()
Definition: TwitchChannel.cpp:810
Definition: SeventvEventAPIDispatch.hpp:33
Atomic< std::shared_ptr< const EmoteMap > > bttvEmotes_
Definition: TwitchChannel.hpp:254
Atomic< std::shared_ptr< const EmoteMap > > seventvEmotes_
Definition: TwitchChannel.hpp:256
boost::optional< EmotePtr > seventvEmote(const EmoteName &name) const
Definition: TwitchChannel.cpp:575