Bug 132984 - allow empty /away command to set away
Summary: allow empty /away command to set away
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-25 19:29 UTC by Albert Astals Cid
Modified: 2006-08-25 20:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2006-08-25 19:29:25 UTC
Version:           0.19+ #3140 (using KDE 3.5.4, compiled sources)
Compiler:          Target: x86_64-linux-gnu
OS:                Linux (x86_64) release 2.6.15-26-amd64-k8

It would be nice if konversation allowed you to set away without specifying an away message by just using
/away
as xchat does.
Comment 1 Eike Hein 2006-08-25 20:41:19 UTC
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);