[Konversation-devel] [Bug 132984] allow empty /away command to set away

Eike Hein sho at eikehein.com
Fri Aug 25 20:41:21 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=132984         
sho eikehein com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sho eikehein com  2006-08-25 20:41 -------
SVN commit 577163 by hein:

* Make parameter-less /away set away state to true with 
  the default away message. Use /back or /unaway to re-
  turn.
BUG:132984
* Use the same "You are not marked as being away." for
  repeated /away's, too. The previous "You are marked 
  as being away." on repeats made it seem like it fail-
  ed to set away.


 M  +3 -13     inputfilter.cpp  
 M  +3 -9      konversationapplication.cpp  
 M  +18 -14    outputfilter.cpp  
 M  +2 -1      outputfilter.h  


--- trunk/extragear/network/konversation/src/inputfilter.cpp #577162:577163
 @ -1585,19 +1585,9  @
             case RPL_NOWAWAY:
             {
                 NickInfo* nickInfo = server->getNickInfo(parameterList[0]);
-                if(nickInfo)
-                {
-                    nickInfo->setAway(true);
-                }
-                if(!server->isAway())
-                {
-                    server->appendMessageToFrontmost(i18n("Away"),i18n("You are now marked as being away."));
-                    emit away();
-                }
-                else
-                {
-                    server->appendMessageToFrontmost(i18n("Away"),i18n("You are marked as being away."));
-                }
+                if (nickInfo) nickInfo->setAway(true);
+                server->appendMessageToFrontmost(i18n("Away"),i18n("You are now marked as being away."));
+                if (!server->isAway()) emit away();
                 break;
             }
             case RPL_UNAWAY:
--- trunk/extragear/network/konversation/src/konversationapplication.cpp #577162:577163
 @ -205,16 +205,10  @
     }
 
     //alreadyaway is true if _any_ servers are away
-    if(alreadyaway)
-    {
-                                                  //toggle as not away
-        sendMultiServerCommand("away", QString::null);
-    }
+    if (alreadyaway)
+        sendMultiServerCommand("back", QString::null);
     else
-    {
-        QString awayReason = i18n("Gone away for now.");
-        sendMultiServerCommand("away", awayReason);
-    }
+        sendMultiServerCommand("away", QString::null);
 }
 
 void KonversationApplication::dcopMultiServerRaw(const QString &command)
--- trunk/extragear/network/konversation/src/outputfilter.cpp #577162:577163
 @ -318,7 +318,8  @
             else if(command == "kick")     result = parseKick(parameter);
             else if(command == "topic")    result = parseTopic(parameter);
             else if(command == "away")     result = parseAway(parameter);
-            else if(command == "back")     result = parseAway(QString::null);
+            else if(command == "unaway")     result = parseBack();
+            else if(command == "back")     result = parseBack();
             else if(command == "invite")   result = parseInvite(parameter);
             else if(command == "exec")     result = parseExec(parameter);
             else if(command == "notify")   result = parseNotify(parameter);
 @ -600,29 +601,32  @
         return result;
     }
 
-    OutputFilterResult OutputFilter::parseAway(const QString &reason)
+    OutputFilterResult OutputFilter::parseAway(QString &reason)
     {
         OutputFilterResult result;
 
-        if(reason.isEmpty())
+        if (reason.isEmpty())
+            reason = i18n("Gone away for now.");
+
+        if (m_server->getIdentity()->getShowAwayMessage())
         {
-            result.toServer = "AWAY";
+            QString message = m_server->getIdentity()->getAwayMessage();
+            emit sendToAllChannels(message.replace(QRegExp("%s",false),reason));
         }
-        else
-        {
-            if(m_server->getIdentity()->getShowAwayMessage())
-            {
-                QString message = m_server->getIdentity()->getAwayMessage();
-                emit sendToAllChannels(message.replace(QRegExp("%s",false),reason));
-            }
 
-            m_server->setAwayReason(reason);
-            result.toServer = "AWAY :" + reason;
-        }
+        m_server->setAwayReason(reason);
+        result.toServer = "AWAY :" + reason;
 
         return result;
     }
 
+    OutputFilterResult OutputFilter::parseBack()
+    {
+        OutputFilterResult result;
+        result.toServer = "AWAY";
+        return result;
+    }
+
     OutputFilterResult OutputFilter::parseNames(const QString &parameter)
     {
         OutputFilterResult result;
--- trunk/extragear/network/konversation/src/outputfilter.h #577162:577163
 @ -118,7 +118,8  @
             OutputFilterResult parseVoice(const QString& parameter);
             OutputFilterResult parseUnvoice(const QString& ownNick, const QString& parameter);
             OutputFilterResult parseTopic(const QString& parameter);
-            OutputFilterResult parseAway(const QString& parameter);
+            OutputFilterResult parseAway(QString& parameter);
+            OutputFilterResult parseBack();
             OutputFilterResult parseCtcp(const QString& parameter);
             OutputFilterResult parsePing(const QString& parameter);
             OutputFilterResult parseVersion(const QString& parameter);


More information about the Konversation-devel mailing list