summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-08-31 19:10:57 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-09-03 10:02:35 (GMT)
commiteb50ea03ab7fc41610a8945002fe19dd30ffb5d7 (patch)
treed26d378e2996b163f13562488eb2bbc31d89db04 /Swift/Controllers/Chat/MUCController.h
parent276d7f82ba42cdbc65ec5c9f35873a265a69bd73 (diff)
downloadswift-eb50ea03ab7fc41610a8945002fe19dd30ffb5d7.zip
swift-eb50ea03ab7fc41610a8945002fe19dd30ffb5d7.tar.bz2
Squash presence in chat and MUC windows.
Join/Parts will be shown in one block if they're uninterrupted, and only the last presence change in a row will be shown for chats. Resolves: #230 Resolves: #430
Diffstat (limited to 'Swift/Controllers/Chat/MUCController.h')
-rw-r--r--Swift/Controllers/Chat/MUCController.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index 31e3d48..4601386 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -31,6 +31,14 @@ namespace Swift {
class TimerFactory;
class TabComplete;
+ enum JoinPart {Join, Part, JoinThenPart, PartThenJoin};
+
+ struct NickJoinPart {
+ NickJoinPart(const String& nick, JoinPart type) : nick(nick), type(type) {};
+ String nick;
+ JoinPart type;
+ };
+
class MUCController : public ChatControllerBase {
public:
MUCController(const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, PresenceSender* presenceSender, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager, UIEventStream* events, bool useDelayForLatency, TimerFactory* timerFactory, EventController* eventController);
@@ -38,6 +46,8 @@ namespace Swift {
boost::signal<void ()> onUserLeft;
virtual void setEnabled(bool enabled);
void rejoin();
+ static void appendToJoinParts(std::vector<NickJoinPart>& joinParts, const NickJoinPart& newEvent);
+ static String generateJoinPartString(std::vector<NickJoinPart> joinParts);
protected:
void preSendMessageRequest(boost::shared_ptr<Message> message);
@@ -47,6 +57,8 @@ namespace Swift {
void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>);
private:
+ void clearPresenceQueue();
+ void addPresenceMessage(const String& message);
void handleWindowClosed();
void handleAvatarChanged(const JID& jid, const String&);
void handleOccupantJoined(const MUCOccupant& occupant);
@@ -61,6 +73,8 @@ namespace Swift {
String roleToFriendlyName(MUCOccupant::Role role);
void receivedActivity();
bool messageTargetsMe(boost::shared_ptr<Message> message);
+ void updateJoinParts();
+ bool shouldUpdateJoinParts();
private:
MUC* muc_;
UIEventStream* events_;
@@ -69,9 +83,11 @@ namespace Swift {
TabComplete* completer_;
bool parting_;
bool joined_;
+ bool lastWasPresence_;
boost::bsignals::scoped_connection avatarChangedConnection_;
boost::shared_ptr<Timer> loginCheckTimer_;
std::set<String> currentOccupants_;
+ std::vector<NickJoinPart> joinParts_;
};
}