Created
March 10, 2011 06:05
-
-
Save fwaggle/863644 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur ../old/src/Channel.cpp src/Channel.cpp | |
--- ../old/src/Channel.cpp 2011-03-10 00:12:59.000000000 -0500 | |
+++ src/Channel.cpp 2011-03-10 00:47:18.000000000 -0500 | |
@@ -47,6 +47,9 @@ | |
cParent = qobject_cast<Channel *>(p); | |
if (cParent) | |
cParent->addChannel(this); | |
+ | |
+ iLastUsed = QDateTime::currentDateTime().toTime_t(); | |
+ | |
#ifdef MUMBLE | |
uiPermissions = 0; | |
#endif | |
@@ -182,10 +185,31 @@ | |
p->cChannel->removeUser(p); | |
p->cChannel = this; | |
qlUsers << p; | |
+ | |
+ qWarning("Last Used: %d", iLastUsed); | |
} | |
void Channel::removeUser(User *p) { | |
qlUsers.removeAll(p); | |
+ | |
+ if (qlUsers.isEmpty()) | |
+ iLastUsed = QDateTime::currentDateTime().toTime_t(); | |
+} | |
+ | |
+int Channel::lastUsed() { | |
+ if (qlUsers.isEmpty()) | |
+ return iLastUsed; | |
+ | |
+ // Still has users in it, return "now". | |
+ return QDateTime::currentDateTime().toTime_t(); | |
+} | |
+ | |
+int Channel::lastUsed(const Channel *c) { | |
+ if (c->qlUsers.isEmpty()) | |
+ return c->iLastUsed; | |
+ | |
+ // Still has users in it, return "now". | |
+ return QDateTime::currentDateTime().toTime_t(); | |
} | |
Channel::operator const QString() const { | |
diff -ur ../old/src/Channel.h src/Channel.h | |
--- ../old/src/Channel.h 2011-03-10 00:12:59.000000000 -0500 | |
+++ src/Channel.h 2011-03-10 00:47:26.000000000 -0500 | |
@@ -45,6 +45,7 @@ | |
Q_DISABLE_COPY(Channel) | |
private: | |
QSet<Channel *> qsUnseen; | |
+ int iLastUsed; | |
public: | |
int iId; | |
int iPosition; | |
@@ -88,6 +89,8 @@ | |
bool isLinked(Channel *c) const; | |
void link(Channel *c); | |
void unlink(Channel *c = NULL); | |
+ int lastUsed(); | |
+ static int lastUsed(const Channel *c); | |
QSet<Channel *> allLinks(); | |
QSet<Channel *> allChildren(); | |
diff -ur ../old/src/murmur/Murmur.ice src/murmur/Murmur.ice | |
--- ../old/src/murmur/Murmur.ice 2011-03-10 00:12:59.000000000 -0500 | |
+++ src/murmur/Murmur.ice 2011-03-10 00:38:30.000000000 -0500 | |
@@ -85,6 +85,8 @@ | |
bool temporary; | |
/** Position of the channel which is used in Client for sorting. */ | |
int position; | |
+ /** Seconds since Epoch that the channel was last used. Will return current time if channel has users in it. */ | |
+ int lastUsed; | |
}; | |
/** A group. Groups are defined per channel, and can inherit members from parent channels. | |
diff -ur ../old/src/murmur/MurmurIce.cpp src/murmur/MurmurIce.cpp | |
--- ../old/src/murmur/MurmurIce.cpp 2011-03-10 00:12:59.000000000 -0500 | |
+++ src/murmur/MurmurIce.cpp 2011-03-10 00:46:18.000000000 -0500 | |
@@ -108,6 +108,7 @@ | |
mc.parent = c->cParent ? c->cParent->iId : -1; | |
mc.description = u8(c->qsDesc); | |
mc.position = c->iPosition; | |
+ mc.lastUsed = ::Channel::lastUsed(c); | |
mc.links.clear(); | |
foreach(::Channel *chn, c->qsPermLinks) | |
mc.links.push_back(chn->iId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment