core: Fix timestamps in manual /away messages
authorShane Synan <digitalcircuit36939@gmail.com>
Fri, 14 Apr 2017 00:26:08 +0000 (19:26 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 24 Apr 2017 21:37:36 +0000 (23:37 +0200)
Change handleAway() to NOT skip timestamp formatting by default.
This is the intended behavior as the one situation where it should be
skipped already manually sets skipFormatting to true.  All other
places deal with unformatted input strings (either from identity or
set by the client).

Remove now-redundant call to formatCurrentDateTimeInString() as the
handleAway command now uses it by default.

Fixes sending "/away Away since %%hh:mm%% on %%dd.MM%%" on the client
not getting formatted as "Away since 07:43 on 22.10" or some such.

Resolves GH-288.

src/core/coresession.cpp
src/core/coreuserinputhandler.h

index 39bd69b..2ca9627 100644 (file)
@@ -662,8 +662,9 @@ void CoreSession::clientsDisconnected()
 
         if (identity->detachAwayEnabled() && !me->isAway()) {
             if (!identity->detachAwayReason().isEmpty())
 
         if (identity->detachAwayEnabled() && !me->isAway()) {
             if (!identity->detachAwayReason().isEmpty())
-                awayReason = formatCurrentDateTimeInString(identity->detachAwayReason());
+                awayReason = identity->detachAwayReason();
             net->setAutoAwayActive(true);
             net->setAutoAwayActive(true);
+            // Allow handleAway() to format the current date/time in the string.
             net->userInputHandler()->handleAway(BufferInfo(), awayReason);
         }
     }
             net->userInputHandler()->handleAway(BufferInfo(), awayReason);
         }
     }
index b13fd39..5c9dcd6 100644 (file)
@@ -49,7 +49,7 @@ public slots:
      * @param[in] skipFormatting  If true, skip timestamp formatting codes (e.g. if already done)
      */
     void handleAway(const BufferInfo &bufferInfo, const QString &text,
      * @param[in] skipFormatting  If true, skip timestamp formatting codes (e.g. if already done)
      */
     void handleAway(const BufferInfo &bufferInfo, const QString &text,
-                    const bool skipFormatting = true);
+                    const bool skipFormatting = false);
     void handleBan(const BufferInfo &bufferInfo, const QString &text);
     void handleUnban(const BufferInfo &bufferInfo, const QString &text);
     void handleCtcp(const BufferInfo &bufferInfo, const QString &text);
     void handleBan(const BufferInfo &bufferInfo, const QString &text);
     void handleUnban(const BufferInfo &bufferInfo, const QString &text);
     void handleCtcp(const BufferInfo &bufferInfo, const QString &text);