summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-02-25 16:09:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-02-25 16:09:05 +0300
commit37bce58a535861b60b718517862ce3824333e477 (patch)
tree7f864bb89454d9daffeeb12de5550bf29700f266
parent899e841aea8e54721ce9771780b05a07de05ce71 (diff)
Jabber: no sense to display missing / non-actual information
-rwxr-xr-xprotocols/JabberG/src/jabber_iqid.cpp3
-rwxr-xr-xprotocols/JabberG/src/jabber_userinfo.cpp49
2 files changed, 25 insertions, 27 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index ad5b04c556..c9e32b6336 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -1516,8 +1516,7 @@ void CJabberProto::OnIqResultLastActivity(const TiXmlElement *iqNode, CJabberIqI
if (pInfo->m_nIqType == JABBER_IQ_TYPE_RESULT) {
if (auto *xmlLast = XmlGetChildByTag(iqNode, "query", "xmlns", JABBER_FEAT_LAST_ACTIVITY)) {
int nSeconds = xmlLast->IntAttribute("seconds");
- if (nSeconds > 0)
- lastActivity = time(0) - nSeconds;
+ lastActivity = (nSeconds == 0) ? 0 : time(0) - nSeconds;
if (const char *szLastStatusMessage = xmlLast->GetText())
r->m_szStatusMessage = mir_strdup(szLastStatusMessage);
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index 1dd2bcc246..eb4a3638b3 100755
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -218,18 +218,17 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti
sttFillInfoLine(hwndTree, htiResource, nullptr, TranslateT("Resource priority"), buf, sttInfoLineId(resource, INFOLINE_PRIORITY));
// Idle
- if (r->m_dwIdleStartTime > 0) {
- mir_strncpy(buf, ctime(&r->m_dwIdleStartTime), _countof(buf));
- size_t len = mir_strlen(buf);
- if (len > 0)
- buf[len - 1] = 0;
- }
- else if (!r->m_dwIdleStartTime)
- mir_strncpy(buf, TranslateU("unknown"), _countof(buf));
- else
- mir_strncpy(buf, TranslateU("<not specified>"), _countof(buf));
+ if (r->m_dwIdleStartTime != -1) {
+ if (r->m_dwIdleStartTime != 0) {
+ mir_strncpy(buf, ctime(&r->m_dwIdleStartTime), _countof(buf));
+ size_t len = mir_strlen(buf);
+ if (len > 0)
+ buf[len - 1] = 0;
+ }
+ else mir_strncpy(buf, TranslateU("<currenty online>"), _countof(buf));
- sttFillInfoLine(hwndTree, htiResource, nullptr, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE));
+ sttFillInfoLine(hwndTree, htiResource, nullptr, TranslateT("Last activity"), buf, sttInfoLineId(resource, INFOLINE_IDLE));
+ }
// caps
mir_snprintf(buf, "%s/%s", item->jid, r->m_szResourceName);
@@ -330,22 +329,22 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM
// logoff
char buf[256];
JABBER_RESOURCE_STATUS *r = item->getTemp();
- if (r->m_dwIdleStartTime > 0) {
- mir_strncpy(buf, ctime(&r->m_dwIdleStartTime), _countof(buf));
- size_t len = mir_strlen(buf);
- if (len > 0)
- buf[len - 1] = 0;
- }
- else if (!r->m_dwIdleStartTime)
- mir_strncpy(buf, TranslateU("unknown"), _countof(buf));
- else
- mir_strncpy(buf, TranslateU("<not specified>"), _countof(buf));
+ if (r->m_dwIdleStartTime != -1) {
+ if (r->m_dwIdleStartTime > 0) {
+ mir_strncpy(buf, ctime(&r->m_dwIdleStartTime), _countof(buf));
+ size_t len = mir_strlen(buf);
+ if (len > 0)
+ buf[len - 1] = 0;
+ }
+ else mir_strncpy(buf, TranslateU("<currently online>"), _countof(buf));
- sttFillInfoLine(hwndTree, htiRoot, nullptr,
- (item->jid && strchr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf,
- sttInfoLineId(0, INFOLINE_LOGOFF));
+ sttFillInfoLine(hwndTree, htiRoot, nullptr,
+ (item->jid && strchr(item->jid, '@')) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf,
+ sttInfoLineId(0, INFOLINE_LOGOFF));
+ }
- sttFillInfoLine(hwndTree, htiRoot, nullptr, TranslateT("Logoff message"), r->m_szStatusMessage, sttInfoLineId(0, INFOLINE_LOGOFF_MSG));
+ if (r->m_szStatusMessage)
+ sttFillInfoLine(hwndTree, htiRoot, nullptr, TranslateT("Logoff message"), r->m_szStatusMessage, sttInfoLineId(0, INFOLINE_LOGOFF_MSG));
// activity
if (item->m_pLastSeenResource)