+
+void CoreSession::clientsConnected() {
+ QHash<NetworkId, NetworkConnection *>::iterator conIter = _connections.begin();
+ Identity *identity = 0;
+ NetworkConnection *con = 0;
+ Network *network = 0;
+ IrcUser *me = 0;
+ QString awayReason;
+ while(conIter != _connections.end()) {
+ con = *conIter;
+ conIter++;
+
+ if(!con->isConnected())
+ continue;
+ identity = con->identity();
+ if(!identity)
+ continue;
+ network = con->network();
+ if(!network)
+ continue;
+ me = network->me();
+ if(!me)
+ continue;
+
+ if(identity->detachAwayEnabled() && me->isAway()) {
+ con->userInputHandler()->handleAway(BufferInfo(), QString());
+ }
+ }
+}
+
+void CoreSession::clientsDisconnected() {
+ QHash<NetworkId, NetworkConnection *>::iterator conIter = _connections.begin();
+ Identity *identity = 0;
+ NetworkConnection *con = 0;
+ Network *network = 0;
+ IrcUser *me = 0;
+ QString awayReason;
+ while(conIter != _connections.end()) {
+ con = *conIter;
+ conIter++;
+
+ if(!con->isConnected())
+ continue;
+ identity = con->identity();
+ if(!identity)
+ continue;
+ network = con->network();
+ if(!network)
+ continue;
+ me = network->me();
+ if(!me)
+ continue;
+
+ if(identity->detachAwayEnabled() && !me->isAway()) {
+ if(identity->detachAwayReasonEnabled())
+ awayReason = identity->detachAwayReason();
+ else
+ awayReason = identity->awayReason();
+ con->userInputHandler()->handleAway(BufferInfo(), awayReason);
+ }
+ }
+}