if(!net->isConnected())
continue;
+
identity = net->identityPtr();
if(!identity)
continue;
}
}
}
+
+
+void CoreSession::globalAway(const QString &msg) {
+ QHash<NetworkId, CoreNetwork *>::iterator netIter = _networks.begin();
+ CoreNetwork *net = 0;
+ while(netIter != _networks.end()) {
+ net = *netIter;
+ netIter++;
+
+ if(!net->isConnected())
+ continue;
+
+ net->userInputHandler()->issueAway(msg, false /* no force away */);
+ }
+}
QHash<QString, QString> persistentChannels(NetworkId) const;
+ //! Marks us away (or unaway) on all networks
+ void globalAway(const QString &msg = QString());
+
signals:
void initialized();
void sessionState(const QVariant &);
// ====================
void CoreUserInputHandler::handleAway(const BufferInfo &bufferInfo, const QString &msg) {
Q_UNUSED(bufferInfo)
+ if(msg.startsWith("-all")) {
+ if(msg.length() == 4) {
+ coreSession()->globalAway();
+ return;
+ }
+ Q_ASSERT(msg.length() > 4);
+ if(msg[4] == ' ') {
+ coreSession()->globalAway(msg.mid(5));
+ return;
+ }
+ }
+ issueAway(msg);
+}
+void CoreUserInputHandler::issueAway(const QString &msg, bool autoCheck) {
QString awayMsg = msg;
IrcUser *me = network()->me();
// if there is no message supplied we have to check if we are already away or not
- if(msg.isEmpty()) {
+ if(autoCheck && msg.isEmpty()) {
if(me && !me->isAway()) {
- awayMsg = network()->identityPtr()->awayReason();
+ Identity *identity = network()->identityPtr();
+ if(identity) {
+ awayMsg = identity->awayReason();
+ }
if(awayMsg.isEmpty()) {
awayMsg = tr("away");
}
void defaultHandler(QString cmd, const BufferInfo &bufferInfo, const QString &text);
void issueQuit(const QString &reason);
+ void issueAway(const QString &msg, bool autoCheck = true);
protected:
void timerEvent(QTimerEvent *event);