From 47802c95395c5b812c8c0bcc286d4da985f9992d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 16 Aug 2022 22:09:28 +0300 Subject: ICQ: fix for custom timestamp printing function --- protocols/ICQ-WIM/src/stdafx.h | 2 +- protocols/ICQ-WIM/src/userinfo.cpp | 8 ++++---- protocols/ICQ-WIM/src/utils.cpp | 18 ++++++------------ 3 files changed, 11 insertions(+), 17 deletions(-) (limited to 'protocols/ICQ-WIM/src') diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index a597674796..6afc028767 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -102,6 +102,6 @@ bool IsChat(const CMStringW &aimid); void RefreshGroups(void); -char* time2text(time_t time); +wchar_t* time2text(time_t time); extern bool g_bSecureIM, g_bMessageState; diff --git a/protocols/ICQ-WIM/src/userinfo.cpp b/protocols/ICQ-WIM/src/userinfo.cpp index 63d5631566..a49ead876a 100644 --- a/protocols/ICQ-WIM/src/userinfo.cpp +++ b/protocols/ICQ-WIM/src/userinfo.cpp @@ -35,10 +35,10 @@ struct IcqUserInfoDlg : public CUserInfoPageDlg SetDlgItemTextW(m_hwnd, IDC_UIN, ppro->GetUserId(m_hContact)); SetDlgItemTextW(m_hwnd, IDC_NICK, ppro->getMStringW(m_hContact, DB_KEY_ICQNICK)); - SetDlgItemTextA(m_hwnd, IDC_IDLETIME, time2text(ppro->getDword(m_hContact, DB_KEY_IDLE))); - SetDlgItemTextA(m_hwnd, IDC_LASTSEEN, time2text(ppro->getDword(m_hContact, DB_KEY_LASTSEEN))); - SetDlgItemTextA(m_hwnd, IDC_MEMBERSINCE, time2text(ppro->getDword(m_hContact, DB_KEY_MEMBERSINCE))); - SetDlgItemTextA(m_hwnd, IDC_ONLINESINCE, time2text(time(0) - ppro->getDword(m_hContact, DB_KEY_ONLINETS))); + SetDlgItemTextW(m_hwnd, IDC_IDLETIME, time2text(ppro->getDword(m_hContact, DB_KEY_IDLE))); + SetDlgItemTextW(m_hwnd, IDC_LASTSEEN, time2text(ppro->getDword(m_hContact, DB_KEY_LASTSEEN))); + SetDlgItemTextW(m_hwnd, IDC_MEMBERSINCE, time2text(ppro->getDword(m_hContact, DB_KEY_MEMBERSINCE))); + SetDlgItemTextW(m_hwnd, IDC_ONLINESINCE, time2text(time(0) - ppro->getDword(m_hContact, DB_KEY_ONLINETS))); return false; } }; diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 58d57778a3..4d6a975cd3 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -326,20 +326,14 @@ void CIcqProto::setId(MCONTACT hContact, const char *szSetting, __int64 iValue) ///////////////////////////////////////////////////////////////////////////////////////// -char* time2text(time_t time) +wchar_t* time2text(time_t ts) { - if (time == 0) - return ""; - - tm *local = localtime(&time); - if (local) { - if (char *str = asctime(local)) { - str[24] = '\0'; // remove new line - return str; - } - } + if (ts == 0) + return L""; - return ""; + static wchar_t buf[100]; + TimeZone_PrintTimeStamp(NULL, ts, L"D t", buf, _countof(buf), 0); + return buf; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3