diff options
author | George Hazan <george.hazan@gmail.com> | 2012-05-30 17:40:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-05-30 17:40:55 +0000 |
commit | 92874115e64ad763e9f56aa2a9f052deb1e8245d (patch) | |
tree | 5df7bc83c014d95331f3adccef1e92d1c02f5b8f | |
parent | 88708cffa15662dcd2755fce699112d24a10a087 (diff) |
another minor sync
git-svn-id: http://svn.miranda-ng.org/main/trunk@239 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_icq.h | 4 | ||||
-rw-r--r-- | include/m_imgsrvc.h | 2 | ||||
-rw-r--r-- | include/m_langpack.h | 2 | ||||
-rw-r--r-- | include/m_netlib.h | 2 | ||||
-rw-r--r-- | include/m_plugins.h | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/oauth.c | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_constants.h | 1 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_menu.cpp | 36 | ||||
-rw-r--r-- | protocols/IcqOscarJ/icq_proto.h | 1 |
9 files changed, 47 insertions, 13 deletions
diff --git a/include/m_icq.h b/include/m_icq.h index 63e226d99b..91e1b9237a 100644 --- a/include/m_icq.h +++ b/include/m_icq.h @@ -63,6 +63,10 @@ typedef struct { // wParam=(WPARAM)hContact
#define MS_REVOKE_AUTH "/RevokeAuth"
+// Open ICQ profile
+// wParam=(WPARAM)hContact
+#define MS_OPEN_PROFILE "/OpenProfile"
+
// Add contact to server-list
// wParam=(WPARAM)hContact
#define MS_ICQ_ADDSERVCONTACT "/AddServerContact"
diff --git a/include/m_imgsrvc.h b/include/m_imgsrvc.h index 37f65f4292..55f4ebe8b3 100644 --- a/include/m_imgsrvc.h +++ b/include/m_imgsrvc.h @@ -1,7 +1,7 @@ /*
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2008 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/include/m_langpack.h b/include/m_langpack.h index 529c672967..cdcd401d59 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2008 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/include/m_netlib.h b/include/m_netlib.h index 34a6647c66..8a810a32f7 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2008 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/include/m_plugins.h b/include/m_plugins.h index 480ecb0967..c47d29e75b 100644 --- a/include/m_plugins.h +++ b/include/m_plugins.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2008 Miranda ICQ/IM project,
+Copyright 2000-2012 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/protocols/Gadu-Gadu/oauth.c b/protocols/Gadu-Gadu/oauth.c index 2e496de677..849852d32b 100644 --- a/protocols/Gadu-Gadu/oauth.c +++ b/protocols/Gadu-Gadu/oauth.c @@ -397,6 +397,7 @@ int gg_oauth_receivetoken(GGPROTO *gg) char szUrl[256], uin[32], *password = NULL, *str, *token = NULL, *token_secret = NULL;
DBVARIANT dbv;
int res = 0;
+ HANDLE nlc = NULL;
UIN2ID(DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, 0), uin);
if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_PASSWORD, &dbv)) {
@@ -413,7 +414,7 @@ int gg_oauth_receivetoken(GGPROTO *gg) req.cbSize = sizeof(req);
req.requestType = REQUEST_POST;
req.szUrl = szUrl;
- req.flags = NLHRF_NODUMP | NLHRF_HTTP11;
+ req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT;
req.headersCount = 3;
req.headers = httpHeaders;
httpHeaders[0].szName = "User-Agent";
@@ -425,6 +426,7 @@ int gg_oauth_receivetoken(GGPROTO *gg) resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)gg->netlib, (LPARAM)&req);
if (resp) {
+ nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
HXML hXml;
TCHAR *xmlAction;
@@ -495,13 +497,12 @@ int gg_oauth_receivetoken(GGPROTO *gg) req.cbSize = sizeof(req);
req.requestType = REQUEST_POST;
req.szUrl = szUrl;
- req.flags = NLHRF_NODUMP | NLHRF_HTTP11;
+ req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_PERSISTENT;
+ req.nlc = nlc;
req.headersCount = 3;
req.headers = httpHeaders;
httpHeaders[1].szName = "Authorization";
httpHeaders[1].szValue = str;
- req.pData = NULL;
- req.dataLength = 0;
resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)gg->netlib, (LPARAM)&req);
if (resp) {
@@ -530,6 +531,7 @@ int gg_oauth_receivetoken(GGPROTO *gg) mir_free(xmlAction);
}
else gg_netlog(gg, "gg_oauth_receivetoken(): Invalid response code from HTTP request");
+ Netlib_CloseHandle(resp->nlc);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
else gg_netlog(gg, "gg_oauth_receivetoken(): No response from HTTP request");
diff --git a/protocols/IcqOscarJ/icq_constants.h b/protocols/IcqOscarJ/icq_constants.h index 2b38866bdd..acb5de9ad3 100644 --- a/protocols/IcqOscarJ/icq_constants.h +++ b/protocols/IcqOscarJ/icq_constants.h @@ -55,6 +55,7 @@ #define ICMI_AUTH_REVOKE 2
#define ICMI_ADD_TO_SERVLIST 3
#define ICMI_XSTATUS_DETAILS 4
+#define ICMI_OPEN_PROFILE 5
/* Some default settings */
#define DEFAULT_SERVER_PORT 5190
diff --git a/protocols/IcqOscarJ/icq_menu.cpp b/protocols/IcqOscarJ/icq_menu.cpp index d576856b32..46da48ad1a 100644 --- a/protocols/IcqOscarJ/icq_menu.cpp +++ b/protocols/IcqOscarJ/icq_menu.cpp @@ -38,8 +38,8 @@ static HANDLE hPrebuildMenuHook;
-HANDLE g_hContactMenuItems[5];
-HANDLE g_hContactMenuSvc[5];
+HANDLE g_hContactMenuItems[6];
+HANDLE g_hContactMenuSvc[6];
static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2)
{
@@ -91,6 +91,12 @@ static INT_PTR IcqMenuHandleXStatusDetails(WPARAM wParam, LPARAM lParam) return (ppro) ? ppro->ShowXStatusDetails(wParam, lParam) : 0;
}
+static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam)
+{
+ CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam);
+ return (ppro) ? ppro->OpenWebProfile(wParam, lParam) : 0;
+}
+
static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable )
{
CLISTMENUITEM clmi = {0};
@@ -109,7 +115,8 @@ static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], FALSE);
sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], FALSE);
sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
-
+ sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
+
CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnPreBuildContactMenu(wParam, lParam) : 0;
}
@@ -170,6 +177,13 @@ void g_MenuInit(void) strcpy(pszDest, MS_XSTATUS_SHOWDETAILS);
g_hContactMenuItems[ICMI_XSTATUS_DETAILS] = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
g_hContactMenuSvc[ICMI_XSTATUS_DETAILS] = CreateServiceFunction(mi.pszService, IcqMenuHandleXStatusDetails);
+
+ // "Open ICQ profile"
+ mi.pszName = LPGEN("Open ICQ profile");
+ mi.position = 1000029997;
+ strcpy(pszDest, MS_OPEN_PROFILE);
+ g_hContactMenuItems[ICMI_OPEN_PROFILE] = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi);
+ g_hContactMenuSvc[ICMI_OPEN_PROFILE] = CreateServiceFunction(mi.pszService, IcqMenuHandleOpenProfile);
}
void g_MenuUninit(void)
@@ -181,15 +195,27 @@ void g_MenuUninit(void) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_AUTH_REVOKE], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], 0);
CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], 0);
+ CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_OPEN_PROFILE], 0);
DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REQUEST]);
DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_GRANT]);
DestroyServiceFunction(g_hContactMenuSvc[ICMI_AUTH_REVOKE]);
DestroyServiceFunction(g_hContactMenuSvc[ICMI_ADD_TO_SERVLIST]);
DestroyServiceFunction(g_hContactMenuSvc[ICMI_XSTATUS_DETAILS]);
+ DestroyServiceFunction(g_hContactMenuSvc[ICMI_OPEN_PROFILE]);
+}
+
+INT_PTR CIcqProto::OpenWebProfile(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ DWORD dwUin = getContactUin(hContact);
+ char url[256];
+ mir_snprintf(url, sizeof(url), "http://www.icq.com/people/%d",dwUin);
+ return CallService(MS_UTILS_OPENURL, 1, (LPARAM)url);
}
+
int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM)
{
HANDLE hContact = (HANDLE)wParam;
@@ -208,13 +234,13 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getSettingByte((HANDLE)wParam, "Grant", 0)));
sttEnableMenuItem(g_hContactMenuItems[ICMI_AUTH_REVOKE],
dwUin && (bCtrlPressed || (getSettingByte(NULL, "PrivacyItems", 0) && !getSettingByte((HANDLE)wParam, "Grant", 0))));
-
sttEnableMenuItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST],
m_bSsiEnabled && !getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) &&
!getSettingWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) &&
!DBGetContactSettingByte(hContact, "CList", "NotOnList", 0));
}
-
+
+ sttEnableMenuItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact));
BYTE bXStatus = getContactXStatus((HANDLE)wParam);
sttEnableMenuItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
diff --git a/protocols/IcqOscarJ/icq_proto.h b/protocols/IcqOscarJ/icq_proto.h index cbb149eacc..ef33b456f6 100644 --- a/protocols/IcqOscarJ/icq_proto.h +++ b/protocols/IcqOscarJ/icq_proto.h @@ -134,6 +134,7 @@ struct CIcqProto : public PROTO_INTERFACE INT_PTR __cdecl GetXStatusIcon(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl GrantAuthorization(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl menuXStatus(WPARAM wParam,LPARAM lParam,LPARAM fParam);
+ INT_PTR __cdecl OpenWebProfile(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl RecvAuth(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl RequestAdvStatusIconIdx(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl RequestAuthorization(WPARAM wParam, LPARAM lParam);
|