diff options
author | dartraiden <wowemuh@gmail.com> | 2019-07-21 19:59:18 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2019-07-21 19:59:18 +0300 |
commit | b078dfb78c89aea87cd422eae52694738e473cf3 (patch) | |
tree | ca896e82a8a5ce81f80d041f4aee7fdeeb007162 /protocols/Gadu-Gadu/src | |
parent | ee7e29d02e94e969c1154515cd0c408c591a2414 (diff) |
Restore "Free for chat" status support (fixes #1963)
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 19 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/dialogs.cpp | 7 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.h | 1 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/services.cpp | 5 |
5 files changed, 36 insertions, 4 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index ba9d0597b2..1ed90ba67c 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -98,6 +98,17 @@ void GaduProto::disconnect() }
break;
+ case ID_STATUS_FREECHAT:
+ gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 9, "modemsg_mutex", 1);
+ szMsg = mir_utf8encodeW(modemsg.freechat);
+ gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1);
+ if (!szMsg && !db_get_s(0, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_WCHAR)) {
+ if (dbv.pwszVal && *(dbv.pwszVal))
+ szMsg = mir_utf8encodeW(dbv.pwszVal);
+ db_free(&dbv);
+ }
+ break;
+
case ID_STATUS_INVISIBLE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 10, "modemsg_mutex", 1);
szMsg = mir_utf8encodeW(modemsg.invisible);
@@ -1536,6 +1547,7 @@ int GaduProto::status_m2gg(int status, int descr) case ID_STATUS_ONLINE: return GG_STATUS_AVAIL_DESCR | mask;
case ID_STATUS_AWAY: return GG_STATUS_BUSY_DESCR | mask;
case ID_STATUS_DND: return GG_STATUS_DND_DESCR | mask;
+ case ID_STATUS_FREECHAT: return GG_STATUS_FFC_DESCR | mask;
case ID_STATUS_INVISIBLE: return GG_STATUS_INVISIBLE_DESCR | mask;
default: return GG_STATUS_BUSY_DESCR | mask;
}
@@ -1546,6 +1558,7 @@ int GaduProto::status_m2gg(int status, int descr) case ID_STATUS_ONLINE: return GG_STATUS_AVAIL | mask;
case ID_STATUS_AWAY: return GG_STATUS_BUSY | mask;
case ID_STATUS_DND: return GG_STATUS_DND | mask;
+ case ID_STATUS_FREECHAT: return GG_STATUS_FFC | mask;
case ID_STATUS_INVISIBLE: return GG_STATUS_INVISIBLE | mask;
default: return GG_STATUS_BUSY | mask;
}
@@ -1569,8 +1582,6 @@ int GaduProto::status_gg2m(int status) case GG_STATUS_AVAIL:
case GG_STATUS_AVAIL_DESCR:
- case GG_STATUS_FFC:
- case GG_STATUS_FFC_DESCR:
return ID_STATUS_ONLINE;
case GG_STATUS_BUSY:
@@ -1580,6 +1591,10 @@ int GaduProto::status_gg2m(int status) case GG_STATUS_DND:
case GG_STATUS_DND_DESCR:
return ID_STATUS_DND;
+
+ case GG_STATUS_FFC:
+ case GG_STATUS_FFC_DESCR:
+ return ID_STATUS_FREECHAT;
case GG_STATUS_INVISIBLE:
case GG_STATUS_INVISIBLE_DESCR:
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index a9d5bb73c9..4302ba3cbd 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -263,6 +263,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_ONLINE, 0)); SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_AWAY, 0)); SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_DND, 0)); + SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_FREECHAT, 0)); SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_INVISIBLE, 0)); switch (gg->getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) { @@ -275,6 +276,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, case ID_STATUS_DND: SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_SETCURSEL, 3, 0); break; + case ID_STATUS_FREECHAT: + SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_SETCURSEL, 4, 0); + break; case ID_STATUS_INVISIBLE: SendDlgItemMessage(hwndDlg, IDC_LEAVESTATUS, CB_SETCURSEL, 5, 0); break; @@ -464,6 +468,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_DND); break; case 4: + gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_FREECHAT); + break; + case 5: gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_INVISIBLE); break; default: diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 6554b18d49..4c11cd975a 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -112,6 +112,7 @@ GaduProto::~GaduProto() if (modemsg.online) mir_free(modemsg.online);
if (modemsg.away) mir_free(modemsg.away);
if (modemsg.dnd) mir_free(modemsg.dnd);
+ if (modemsg.freechat) mir_free(modemsg.freechat);
if (modemsg.invisible) mir_free(modemsg.invisible);
if (modemsg.offline) mir_free(modemsg.offline);
}
@@ -145,10 +146,10 @@ INT_PTR GaduProto::GetCaps(int type, MCONTACT) return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_EXTSEARCHUI | PF1_SEARCHBYNAME |
PF1_MODEMSG | PF1_NUMERICUSERID | PF1_VISLIST | PF1_FILE;
case PFLAGNUM_2:
- return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE |
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE |
PF2_LONGAWAY;
case PFLAGNUM_3:
- return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE;
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE;
case PFLAGNUM_4:
return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE;
case PFLAGNUM_5:
@@ -631,6 +632,9 @@ int GaduProto::SetAwayMsg(int iStatus, const wchar_t *newMsg) case ID_STATUS_DND:
msgPtr = &modemsg.dnd;
break;
+ case ID_STATUS_FREECHAT:
+ msgPtr = &modemsg.freechat;
+ break;
case ID_STATUS_INVISIBLE:
msgPtr = &modemsg.invisible;
break;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 2e9db7566c..ada0efe1d8 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -239,6 +239,7 @@ struct GaduProto : public PROTO<GaduProto> wchar_t *online;
wchar_t *away;
wchar_t *dnd;
+ wchar_t *freechat;
wchar_t *invisible;
wchar_t *offline;
};
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index eac7fcbd63..2b959d6e9d 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -32,6 +32,7 @@ char *gg_status2db(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;
@@ -56,6 +57,9 @@ wchar_t* GaduProto::getstatusmsg(int status) case ID_STATUS_DND:
return modemsg.dnd;
break;
+ case ID_STATUS_FREECHAT:
+ return modemsg.freechat;
+ break;
case ID_STATUS_INVISIBLE:
return modemsg.invisible;
break;
@@ -128,6 +132,7 @@ int gg_normalizestatus(int status) switch (status) {
case ID_STATUS_ONLINE: return ID_STATUS_ONLINE;
case ID_STATUS_DND: return ID_STATUS_DND;
+ case ID_STATUS_FREECHAT: return ID_STATUS_FREECHAT;
case ID_STATUS_OFFLINE: return ID_STATUS_OFFLINE;
case ID_STATUS_INVISIBLE: return ID_STATUS_INVISIBLE;
}
|