From b078dfb78c89aea87cd422eae52694738e473cf3 Mon Sep 17 00:00:00 2001 From: dartraiden Date: Sun, 21 Jul 2019 19:59:18 +0300 Subject: Restore "Free for chat" status support (fixes #1963) --- src/core/stdautoaway/src/autoaway.cpp | 4 ++-- src/core/stdaway/src/sendmsg.cpp | 4 +++- src/core/stdclist/src/clcopts.cpp | 4 +++- src/core/stdclist/src/contact.cpp | 1 + src/core/stdmsg/src/msgoptions.cpp | 3 ++- src/core/stdmsg/src/msgs.cpp | 1 + src/core/stduseronline/src/useronline.cpp | 2 +- 7 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp index 6511746e2a..40f9c2779d 100644 --- a/src/core/stdautoaway/src/autoaway.cpp +++ b/src/core/stdautoaway/src/autoaway.cpp @@ -75,7 +75,7 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) status = ID_STATUS_AWAY; if (lParam & IDF_ISIDLE) { - if (pa->iRealStatus != ID_STATUS_ONLINE) { + if (pa->iRealStatus != ID_STATUS_ONLINE && pa->iRealStatus != ID_STATUS_FREECHAT) { Netlib_Logf(0, "%s: '%s' isn't online (%d), skipping", MODULENAME, pa->szModuleName, pa->iRealStatus); continue; } @@ -87,7 +87,7 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) } else { int oldstatus = g_plugin.getWord(pa->szModuleName, 0); - if (oldstatus != ID_STATUS_ONLINE) { + if (oldstatus != ID_STATUS_ONLINE && oldstatus != ID_STATUS_FREECHAT) { Netlib_Logf(0, "%s: '%s' wasn't online (%d), skipping", MODULENAME, pa->szModuleName, oldstatus); continue; } diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index bd4b8440ee..bd6e9c6446 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -34,6 +34,7 @@ static const wchar_t* GetDefaultMessage(int status) case ID_STATUS_NA: return TranslateT("Give it up, I'm not in!"); case ID_STATUS_OCCUPIED: return TranslateT("Not right now."); case ID_STATUS_DND: return TranslateT("Give a guy some peace, would ya?"); + case ID_STATUS_FREECHAT: return TranslateT("I'm a chatbot!"); case ID_STATUS_ONLINE: return TranslateT("Yep, I'm here."); case ID_STATUS_OFFLINE: return TranslateT("Nope, not here."); case ID_STATUS_INVISIBLE: return TranslateT("I'm hiding from the mafia."); @@ -52,6 +53,7 @@ static const char* StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_NA: prefix = "Na"; break; case ID_STATUS_DND: prefix = "Dnd"; break; case ID_STATUS_OCCUPIED: prefix = "Occupied"; break; + case ID_STATUS_FREECHAT: prefix = "FreeChat"; break; case ID_STATUS_ONLINE: prefix = "On"; break; case ID_STATUS_OFFLINE: prefix = "Off"; break; case ID_STATUS_INVISIBLE: prefix = "Inv"; break; @@ -334,7 +336,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam) static const int statusModes[] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, - ID_STATUS_INVISIBLE, ID_STATUS_IDLE + ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_IDLE }; struct AwayMsgInfo diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index c9070e91f3..ee4c3860f2 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -66,6 +66,7 @@ static const struct CheckBoxValues_t greyoutValues[] = { PF2_LONGAWAY, LPGENW("Not available") }, { PF2_LIGHTDND, LPGENW("Occupied") }, { PF2_HEAVYDND, LPGENW("Do not disturb")}, + { PF2_FREECHAT, LPGENW("Free for chat") }, { PF2_INVISIBLE, LPGENW("Invisible") } }; @@ -77,7 +78,8 @@ static const struct CheckBoxValues_t offlineValues[] = { PF2_LONGAWAY, LPGENW("Not available") }, { PF2_LIGHTDND, LPGENW("Occupied") }, { PF2_HEAVYDND, LPGENW("Do not disturb")}, - { PF2_INVISIBLE, LPGENW("Invisible") }, + { PF2_FREECHAT, LPGENW("Free for chat") }, + { PF2_INVISIBLE, LPGENW("Invisible") } }; static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index 3a561482d0..9b40331e2f 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -38,6 +38,7 @@ static statusModeOrder[] = { ID_STATUS_DND, 110 }, { ID_STATUS_NA, 450 }, { ID_STATUS_OCCUPIED, 100 }, + { ID_STATUS_FREECHAT, 0 }, { ID_STATUS_INVISIBLE, 20 } }; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index e4ce31045b..5d8565a7a2 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -139,7 +139,8 @@ statusValues[] = { PF2_LONGAWAY, LPGENW("Not available") }, { PF2_LIGHTDND, LPGENW("Occupied") }, { PF2_HEAVYDND, LPGENW("Do not disturb") }, - { PF2_INVISIBLE, LPGENW("Invisible") }, + { PF2_FREECHAT, LPGENW("Free for chat") }, + { PF2_INVISIBLE, LPGENW("Invisible") } }; class COptionMainDlg : public CDlgBase diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index e78c57968a..50c98f7a98 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -108,6 +108,7 @@ static int SRMMStatusToPf2(int status) case ID_STATUS_DND: return PF2_HEAVYDND; case ID_STATUS_NA: return PF2_LONGAWAY; case ID_STATUS_OCCUPIED: return PF2_LIGHTDND; + case ID_STATUS_FREECHAT: return PF2_FREECHAT; case ID_STATUS_INVISIBLE: return PF2_INVISIBLE; case ID_STATUS_OFFLINE: return MODEF_OFFLINE; } diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index e1de0b8f03..1c3a6d3640 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -46,7 +46,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) } } - if (newStatus == ID_STATUS_ONLINE && oldStatus != ID_STATUS_ONLINE) { + if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) && oldStatus != ID_STATUS_ONLINE && oldStatus != ID_STATUS_FREECHAT) { DWORD ticked = g_plugin.getDword(cws->szModule, GetTickCount()); // only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline if (GetTickCount() - ticked > (1000 * 10)) { -- cgit v1.2.3