diff options
author | George Hazan <ghazan@miranda.im> | 2019-07-04 15:39:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-07-04 15:39:26 +0300 |
commit | 4587283773e8d942a0aee38b5937219a845a78a0 (patch) | |
tree | 161adcb770c96becccba8c03286e4c6b382e5d6c /protocols/ICQ-WIM | |
parent | a19f36229e9e131f000161d23e729b1fbca58b3e (diff) |
ICQ-WIM: fix for server group parsing
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/stdafx.h | 1 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/utils.cpp | 16 |
3 files changed, 16 insertions, 5 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index df5dc4e5a1..8347f2a8e8 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -27,7 +27,7 @@ void CIcqProto::ProcessBuddyList(const JSONNode &ev) for (auto &it : ev["groups"]) { CMStringW szGroup = it["name"].as_mstring(); - szGroup.Replace(L">", L"\\"); + parseGroup(szGroup); bool bCreated = false; for (auto &buddy : it["buddies"]) { @@ -71,7 +71,7 @@ void CIcqProto::ProcessDiff(const JSONNode &ev) for (auto &it : block["data"]) { CMStringW szGroup = it["name"].as_mstring(); - szGroup.Replace(L">", L"\\"); + parseGroup(szGroup); bool bCreated = false; for (auto &buddy : it["buddies"]) { diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index b216ec459a..a02de67fdf 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -100,6 +100,7 @@ bool IsChat(const CMStringW &aimid); int StatusFromString(const CMStringW&); +void parseGroup(CMStringW &wszGroup); char* time2text(time_t time); extern HWND g_hwndHeartbeat; diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 786c4679f2..10a7874498 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -311,6 +311,15 @@ void CIcqProto::setId(MCONTACT hContact, const char *szSetting, __int64 iValue) ///////////////////////////////////////////////////////////////////////////////////////// +void parseGroup(CMStringW &wszGroup) +{ + wszGroup.Replace(L">", L"\\"); + if (wszGroup[0] == '\\') + wszGroup.Delete(0, 1); +} + +///////////////////////////////////////////////////////////////////////////////////////// + char* time2text(time_t time) { if (time == 0) @@ -318,9 +327,10 @@ char* time2text(time_t time) tm *local = localtime(&time); if (local) { - char *str = asctime(local); - str[24] = '\0'; // remove new line - return str; + if (char *str = asctime(local)) { + str[24] = '\0'; // remove new line + return str; + } } return "<invalid>"; |