}
return prettyDigest;
}
+
+QString formatCurrentDateTimeInString(QString str)
+{
+ /*
+ * Find %%<text>%% in string. Repleace inside text which is format to QDateTime
+ * with current timestamp.
+ */
+ QRegExp rx("\\%%(.*)\\%%");
+ rx.setMinimal(true);
+ int s = rx.indexIn(str);
+ if (s >= 0)
+ str.replace(s, rx.cap(0).length(), QDateTime::currentDateTime().toString(rx.cap(1)));
+
+ return str;
+}
#include <QVariant>
#include <QString>
#include <QMetaMethod>
+#include <QDateTime>
// TODO Use versions from Network instead
QString nickFromMask(QString mask);
QByteArray prettyDigest(const QByteArray &digest);
+QString formatCurrentDateTimeInString(QString str);
+
#endif
if (identity->detachAwayEnabled() && !me->isAway()) {
if (!identity->detachAwayReason().isEmpty())
- awayReason = identity->detachAwayReason();
+ awayReason = formatCurrentDateTimeInString(identity->detachAwayReason());
net->setAutoAwayActive(true);
net->userInputHandler()->handleAway(BufferInfo(), awayReason);
}
if (me && !me->isAway()) {
Identity *identity = network()->identityPtr();
if (identity) {
- awayMsg = identity->awayReason();
+ awayMsg = formatCurrentDateTimeInString(identity->awayReason());
}
if (awayMsg.isEmpty()) {
awayMsg = tr("away");
<bool>true</bool>
</property>
<property name="toolTip">
- <string>Default away reason</string>
+ <string><html><head/><body><p>Default away reason. You can add date/time to this message using syntax: %% &lt;format&gt; %%. Where &lt;format&gt; is: <br/>hh - the hour<br/>mm - the minutes<br/>ss - second<br/>AP - AM/PM<<br/>dd - day<br/>MM - month</p></body></html></string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="detachAwayEnabled">
<property name="toolTip">
- <string>Set away when all clients have detached from the core</string>
+ <string><html><head/><body><p>Set away when all clients have detached from the core. You can add date/time to this message using syntax: %% &lt;format&gt; %%. Where &lt;format&gt; is:<br/>hh - the hour<br/>mm - the minutes<br/>ss - second<br/>AP - AM/PM<br/>dd - day<br/>MM - month</p></body></html></string>
</property>
<property name="title">
<string>Away On Detach</string>