summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-28 20:28:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-28 20:28:13 +0300
commit0c508d74bee722c4d0032b33377a1305b484027a (patch)
tree224be76126cb0e208843f818deb5a6c6cdba1761
parent34ff0a2b21a357f80e798940df9ce887dcf1e185 (diff)
obsolte perversion with PF4_INFOSETTINGSVC removed
-rw-r--r--include/m_protosvc.h16
-rw-r--r--plugins/SpellChecker/src/utils.cpp16
-rw-r--r--protocols/Icq10/src/proto.cpp2
-rw-r--r--protocols/Icq10/src/server.cpp18
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp33
-rw-r--r--src/mir_app/src/contacts.cpp28
6 files changed, 31 insertions, 82 deletions
diff --git a/include/m_protosvc.h b/include/m_protosvc.h
index 7e0daf7f83..96fffc1732 100644
--- a/include/m_protosvc.h
+++ b/include/m_protosvc.h
@@ -142,7 +142,6 @@ static __inline unsigned long Proto_Status2Flag(int status)
#define PF4_AVATARS 0x00000020 // protocol has avatar support
#define PF4_OFFLINEFILES 0x00000040 // protocols supports sending files to offline users
#define PF4_IMSENDOFFLINE 0x00000100 // protocol supports sending offline messages
-#define PF4_INFOSETTINGSVC 0x00000200 // protocol supports user info translation services
#define PF4_NOAUTHDENYREASON 0x00000400 // protocol doesn't support authorization deny reason
#define PF4_GROUPCHATFILES 0x00000800 // protocol supports sending files to group chats
#define PF4_SINGLEFILEONLY 0x00001000 // protocol supports sending files one by one only
@@ -485,21 +484,6 @@ struct PROTOFILERESUME
#define PS_LEAVECHAT "/LeaveChat"
///////////////////////////////////////////////////////////////////////////////
-// Asks a protocol to read contact information and translate them (for a lookup fields)
-// wParam = (MCONTACT)hContact
-// lParam = (LPARAM)(DBCONTACTGETSETTING*)&dbcgs
-// The flag PF4_INFOSETTINGSVC indicates that a protocol supports this. Basically it should
-// do the same as MS_DB_CONTACT_GETSETTING_STR, except that for a lookup settings (e.g. Language)
-// it returns string instead of an ID stored in the database.
-// Caller is responsible for free()ing dbcgs.pValue->pszVal and pbVal if they are
-// returned. You must **NOT** do this from your version of free() you have to use Miranda's free()
-// you can get a function pointer to Miranda's free() via MS_SYSTEM_GET_MMI, see m_system.h
-// Returns 0 on success or nonzero if the setting name was not found or hContact
-// was invalid
-
-#define PS_GETINFOSETTING "/GetInfoSetting"
-
-///////////////////////////////////////////////////////////////////////////////
// Asks protocol for the status message for a status
// wParam = (WORD) 0 for current status or a status id
// lParam = SGMA_xxx
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index c15dba0830..a81c075e20 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -709,20 +709,8 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch
{
DBVARIANT dbv = { 0 };
dbv.type = DBVT_WCHAR;
-
- int caps = (isProtocol ? CallProtoService(group, PS_GETCAPS, PFLAGNUM_4, 0) : 0);
- if (caps & PF4_INFOSETTINGSVC) {
- DBCONTACTGETSETTING cgs = {};
- cgs.szModule = group;
- cgs.szSetting = setting;
- cgs.pValue = &dbv;
- if (CallProtoService(group, PS_GETINFOSETTING, hContact, (LPARAM)&cgs))
- return;
- }
- else {
- if (db_get_ws(hContact, group, setting, &dbv))
- return;
- }
+ if (db_get_ws(hContact, group, setting, &dbv))
+ return;
if (dbv.type == DBVT_WCHAR && dbv.pwszVal != nullptr) {
wchar_t *lang = dbv.pwszVal;
diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp
index 3e41f4e63c..f539f3ef40 100644
--- a/protocols/Icq10/src/proto.cpp
+++ b/protocols/Icq10/src/proto.cpp
@@ -208,7 +208,7 @@ INT_PTR CIcqProto::GetCaps(int type, MCONTACT hContact)
return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE;
case PFLAGNUM_4:
- nReturn = PF4_FORCEAUTH | PF4_SUPPORTIDLE | PF4_IMSENDOFFLINE | PF4_INFOSETTINGSVC | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_SERVERMSGID;
+ nReturn = PF4_FORCEAUTH | PF4_SUPPORTIDLE | PF4_IMSENDOFFLINE | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_SERVERMSGID;
break;
case PFLAGNUM_5:
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp
index d2d84e39b9..e7c49a7e04 100644
--- a/protocols/Icq10/src/server.cpp
+++ b/protocols/Icq10/src/server.cpp
@@ -173,6 +173,24 @@ void CIcqProto::RetrieveUserInfo(MCONTACT hContact)
void CIcqProto::SetServerStatus(int iStatus)
{
+ const char *szStatus = "online";
+ int invisible = 0;
+
+ switch (iStatus) {
+ case ID_STATUS_OFFLINE: szStatus = "offline"; break;
+ case ID_STATUS_NA: szStatus = "occupied"; break;
+ case ID_STATUS_AWAY:
+ case ID_STATUS_DND: szStatus = "away"; break;
+ case ID_STATUS_INVISIBLE:
+ invisible = 1;
+ }
+
+ auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, ICQ_API_SERVER "/presence/setState");
+ pReq->flags |= NLHRF_NODUMPSEND;
+ pReq << CHAR_PARAM("f", "json") << CHAR_PARAM("aimsid", m_aimsid) << CHAR_PARAM("r", pReq->m_reqId)
+ << CHAR_PARAM("view", szStatus) << INT_PARAM("invisible", invisible);
+ Push(pReq);
+
int iOldStatus = m_iStatus; m_iStatus = iStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
}
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index 2bea6486fe..41b8e50c7a 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -36,42 +36,16 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
#define SVS_TIMEZONE 7
#define SVS_MARITAL 8
-static int Proto_GetContactInfoSetting(MCONTACT hContact, const char *szProto, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType)
-{
- DBCONTACTGETSETTING cgs = { szModule, szSetting, dbv };
- dbv->type = (BYTE)nType;
-
- return CallProtoService(szProto, PS_GETINFOSETTING, hContact, (LPARAM)&cgs);
-}
-
-static wchar_t* Proto_GetContactInfoSettingStr(bool proto_service, MCONTACT hContact, const char *szModule, const char *szSetting)
-{
- if (!proto_service)
- return db_get_wsa(hContact, szModule, szSetting);
-
- DBVARIANT dbv;
- DBCONTACTGETSETTING cgs = { szModule, szSetting, &dbv };
- dbv.type = DBVT_WCHAR;
- if (CallProtoService(szModule, PS_GETINFOSETTING, hContact, (LPARAM)&cgs))
- return nullptr;
-
- return dbv.pwszVal;
-}
-
static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special)
{
char str[80], *pstr = nullptr;
wchar_t *ptstr = nullptr;
- char *szProto = GetContactProto(hContact);
- bool proto_service = szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC);
DBVARIANT dbv = { DBVT_DELETED };
int unspecified;
if (szModule == nullptr)
unspecified = 1;
- else if (proto_service)
- unspecified = Proto_GetContactInfoSetting(hContact, szProto, szModule, szSetting, &dbv, 0);
else
unspecified = db_get_s(hContact, szModule, szSetting, &dbv, 0);
@@ -435,7 +409,6 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
if (szProto == nullptr)
break;
- bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC);
// past
@@ -445,7 +418,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Past%d", i);
- ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(db_get_wsa(hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Past%dText", i);
@@ -462,7 +435,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
// affiliation
for (int i = 0;; i++) {
mir_snprintf(idstr, "Affiliation%d", i);
- ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(db_get_wsa(hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Affiliation%dText", i);
@@ -485,7 +458,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
lvi.iItem = 0;
for (int i = 0;; i++) {
mir_snprintf(idstr, "Interest%dCat", i);
- ptrW tszColText(Proto_GetContactInfoSettingStr(proto_service, hContact, szProto, idstr));
+ ptrW tszColText(db_get_wsa(hContact, szProto, idstr));
if (tszColText == NULL)
break;
mir_snprintf(idstr, "Interest%dText", i);
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 447af7ea02..320012762c 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -40,24 +40,10 @@ static wchar_t* nameOrderDescr[ NAMEORDERCOUNT ] =
BYTE nameOrder[NAMEORDERCOUNT];
-static int GetDatabaseString(MCONTACT hContact, const char *szProto, const char *szSetting, DBVARIANT *dbv)
-{
- if (mir_strcmp(szProto, "CList") && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) {
- DBCONTACTGETSETTING cgs = { szProto, szSetting, dbv };
- dbv->type = DBVT_WCHAR;
-
- INT_PTR res = CallProtoService(szProto, PS_GETINFOSETTING, (WPARAM)hContact, (LPARAM)&cgs);
- if (res != CALLSERVICE_NOTFOUND)
- return res;
- }
-
- return db_get_ws(hContact, szProto, szSetting, dbv);
-}
-
static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting)
{
DBVARIANT dbv;
- if (!GetDatabaseString(hContact, szProto, szSetting, &dbv)) {
+ if (!db_get_ws(hContact, szProto, szSetting, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
if (!dbv.pszVal[0]) break;
@@ -144,7 +130,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
case CNF_COUNTRY:
case CNF_COCOUNTRY:
- if (!GetDatabaseString(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv))
+ if (!db_get_ws(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv))
return dbv.pwszVal;
if (!db_get(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) {
@@ -164,9 +150,9 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
break;
case CNF_FIRSTLAST:
- if (!GetDatabaseString(hContact, szProto, "FirstName", &dbv)) {
+ if (!db_get_ws(hContact, szProto, "FirstName", &dbv)) {
DBVARIANT dbv2;
- if (!GetDatabaseString(hContact, szProto, "LastName", &dbv2)) {
+ if (!db_get_ws(hContact, szProto, "LastName", &dbv2)) {
size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
if (buf != nullptr)
@@ -232,7 +218,7 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
// protocol must define a PFLAG_UNIQUEIDSETTING
uid = Proto_GetUniqueId(szProto);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
- if (!GetDatabaseString(hContact, szProto, uid, &dbv)) {
+ if (!db_get_ws(hContact, szProto, uid, &dbv)) {
if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) {
long value = (dbv.type == DBVT_BYTE) ? dbv.bVal : (dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal);
WCHAR buf[40];
@@ -246,9 +232,9 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s
case 6: // first + last name
case 7: // last + first name
- if (!GetDatabaseString(hContact, szProto, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) {
+ if (!db_get_ws(hContact, szProto, nameOrder[i] == 6 ? "FirstName" : "LastName", &dbv)) {
DBVARIANT dbv2;
- if (!GetDatabaseString(hContact, szProto, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) {
+ if (!db_get_ws(hContact, szProto, nameOrder[i] == 6 ? "LastName" : "FirstName", &dbv2)) {
size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
WCHAR* buf = (WCHAR*)mir_alloc(sizeof(WCHAR)*len);
if (buf != nullptr)