summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-24 19:50:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-24 19:50:44 +0000
commitf6de1e36aeeeb662a04e3287b3929a07384bf510 (patch)
treede89ca1a736fe457d805d36062513427088bbf7a /protocols
parent3fed56c332215dd3a753d2fc0b31616c1b270a51 (diff)
- IJabberNetInterface::GetHandle() method added to retrieve a network handle;
- another major clutch removed from GTalkExt; - version.rc added; - bunch of crap removed; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4177 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/GTalkExt/GTalkExt_10.vcxproj1
-rw-r--r--protocols/GTalkExt/GTalkExt_10.vcxproj.filters3
-rw-r--r--protocols/GTalkExt/GTalkExt_11.vcxproj1
-rw-r--r--protocols/GTalkExt/GTalkExt_11.vcxproj.filters3
-rw-r--r--protocols/GTalkExt/res/Version.rc38
-rw-r--r--protocols/GTalkExt/res/settings.rc36
-rw-r--r--protocols/GTalkExt/src/GTalkExt.cpp21
-rw-r--r--protocols/GTalkExt/src/Version.h14
-rw-r--r--protocols/GTalkExt/src/db.cpp2
-rw-r--r--protocols/GTalkExt/src/inbox.cpp137
-rw-r--r--protocols/GTalkExt/src/notifications.cpp57
-rw-r--r--protocols/GTalkExt/src/options.cpp180
-rw-r--r--protocols/GTalkExt/src/options.h3
-rw-r--r--protocols/GTalkExt/src/resources.h7
-rw-r--r--protocols/GTalkExt/src/stdafx.h1
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp6
-rw-r--r--protocols/JabberG/src/jabber.h4
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp4
-rw-r--r--protocols/JabberG/src/jabber_proto.h30
-rw-r--r--protocols/JabberG/src/jabber_std.cpp11
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp5
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp3
22 files changed, 256 insertions, 311 deletions
diff --git a/protocols/GTalkExt/GTalkExt_10.vcxproj b/protocols/GTalkExt/GTalkExt_10.vcxproj
index b5d0f625cf..0972d8f3e7 100644
--- a/protocols/GTalkExt/GTalkExt_10.vcxproj
+++ b/protocols/GTalkExt/GTalkExt_10.vcxproj
@@ -206,6 +206,7 @@
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\settings.rc" />
+ <ResourceCompile Include="res\Version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/GTalkExt/GTalkExt_10.vcxproj.filters b/protocols/GTalkExt/GTalkExt_10.vcxproj.filters
index d30ac9881f..c4669a5f90 100644
--- a/protocols/GTalkExt/GTalkExt_10.vcxproj.filters
+++ b/protocols/GTalkExt/GTalkExt_10.vcxproj.filters
@@ -88,5 +88,8 @@
<ResourceCompile Include="res\settings.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/GTalkExt/GTalkExt_11.vcxproj b/protocols/GTalkExt/GTalkExt_11.vcxproj
index 3cb0f6aaf4..935e6d1b69 100644
--- a/protocols/GTalkExt/GTalkExt_11.vcxproj
+++ b/protocols/GTalkExt/GTalkExt_11.vcxproj
@@ -210,6 +210,7 @@
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\settings.rc" />
+ <ResourceCompile Include="res\Version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/GTalkExt/GTalkExt_11.vcxproj.filters b/protocols/GTalkExt/GTalkExt_11.vcxproj.filters
index d30ac9881f..c4669a5f90 100644
--- a/protocols/GTalkExt/GTalkExt_11.vcxproj.filters
+++ b/protocols/GTalkExt/GTalkExt_11.vcxproj.filters
@@ -88,5 +88,8 @@
<ResourceCompile Include="res\settings.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\Version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/GTalkExt/res/Version.rc b/protocols/GTalkExt/res/Version.rc
new file mode 100644
index 0000000000..5bfbab4754
--- /dev/null
+++ b/protocols/GTalkExt/res/Version.rc
@@ -0,0 +1,38 @@
+// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#include "afxres.h"
+#include "..\src\version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/protocols/GTalkExt/res/settings.rc b/protocols/GTalkExt/res/settings.rc
index 533eceaa59..0e7dbee2a6 100644
--- a/protocols/GTalkExt/res/settings.rc
+++ b/protocols/GTalkExt/res/settings.rc
@@ -42,41 +42,5 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
-
-
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION PLUGIN_FILE_VERSION
- PRODUCTVERSION PLUGIN_FILE_VERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-{
- BLOCK "StringFileInfo"
- {
- BLOCK "040904b0"
- {
- VALUE "FileDescription", PLUGIN_DESCRIPTION
- VALUE "FileVersion", PLUGIN_VERSION_STRING
- VALUE "InternalName", SHORT_PLUGIN_NAME
- VALUE "LegalCopyright", COPYRIGHT_STRING
- VALUE "OriginalFilename", SHORT_PLUGIN_NAME ".dll"
- VALUE "PrivateBuild", "Yes"
- VALUE "ProductName", PLUGIN_DESCRIPTION
- VALUE "ProductVersion", PLUGIN_VERSION_STRING
- }
- }
- BLOCK "VarFileInfo"
- {
- VALUE "Translation", 0x409, 1200
- }
-}
-
IDI_POPUP ICON "PopupIcon.ico"
IDI_PSEUDOAVA PNG "pseudoava.png" \ No newline at end of file
diff --git a/protocols/GTalkExt/src/GTalkExt.cpp b/protocols/GTalkExt/src/GTalkExt.cpp
index a449435cb3..e2eeb754ee 100644
--- a/protocols/GTalkExt/src/GTalkExt.cpp
+++ b/protocols/GTalkExt/src/GTalkExt.cpp
@@ -28,6 +28,7 @@
#include "tipper_items.h"
#include "avatar.h"
#include "menu.h"
+#include "Version.h"
int hLangpack;
HICON g_hPopupIcon = 0;
@@ -35,15 +36,16 @@ HICON g_hPopupIcon = 0;
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
- PLUGIN_DESCRIPTION,
- PLUGIN_VERSION_DWORD,
- "GTalk mail notification extensions for Jabber protocol.",
- "bems",
- "bems@vingrad.ru",
- COPYRIGHT_STRING,
- "http://miranda-ng.org/",
- UNICODE_AWARE, //doesn't replace anything built-in
- {0x08B86253, 0xEC6E, 0x4d09, { 0xB7, 0xA9, 0x64, 0xAC, 0xDF, 0x06, 0x27, 0xB8 }} //{08B86253-EC6E-4d09-B7A9-64ACDF0627B8}
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
+ UNICODE_AWARE,
+ //{08B86253-EC6E-4d09-B7A9-64ACDF0627B8}
+ {0x08B86253, 0xEC6E, 0x4d09, { 0xB7, 0xA9, 0x64, 0xAC, 0xDF, 0x06, 0x27, 0xB8 }}
};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -100,7 +102,6 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookOptionsInitialization();
InitMenus(FALSE);
InitAvaUnit(FALSE);
return 0;
diff --git a/protocols/GTalkExt/src/Version.h b/protocols/GTalkExt/src/Version.h
new file mode 100644
index 0000000000..10e6a7aa79
--- /dev/null
+++ b/protocols/GTalkExt/src/Version.h
@@ -0,0 +1,14 @@
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 1
+#define __BUILD_NUM 1
+
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+
+#define __PLUGIN_NAME "GTalk Extension"
+#define __FILENAME "GTalkExt.dll"
+#define __DESCRIPTION "GTalk extensions for Jabber protocol"
+#define __AUTHOR "bems"
+#define __AUTHOREMAIL "bems@vingrad.ru"
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2010-11 bems"
diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp
index dcdde85451..bab22c21ed 100644
--- a/protocols/GTalkExt/src/db.cpp
+++ b/protocols/GTalkExt/src/db.cpp
@@ -72,7 +72,7 @@ void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting)
{
char *ansiJid = WtoA(jid);
__try {
- DBWriteContactSettingTString(0, name, ansiJid, setting);
+ db_set_ts(0, name, ansiJid, setting);
}
__finally {
free(ansiJid);
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index b1c8531b9d..cff579bb4c 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -25,39 +25,39 @@
#include "db.h"
#include "options.h"
-static const LPTSTR COMMON_GMAIL_HOST1 = _T("gmail.com");
-static const LPTSTR COMMON_GMAIL_HOST2 = _T("googlemail.com");
+const LPTSTR COMMON_GMAIL_HOST1 = _T("gmail.com");
+const LPTSTR COMMON_GMAIL_HOST2 = _T("googlemail.com");
-static const LPSTR AUTH_REQUEST_URL = "https://www.google.com/accounts/ClientAuth";
-static const LPSTR AUTH_REQUEST_PARAMS = "Email=%s&Passwd=%s&"
+const LPSTR AUTH_REQUEST_URL = "https://www.google.com/accounts/ClientAuth";
+const LPSTR AUTH_REQUEST_PARAMS = "Email=%s&Passwd=%s&"
"accountType=HOSTED_OR_GOOGLE&"
"skipvpage=true&"
"PersistentCookie=false";
-static const LPSTR ISSUE_TOKEN_REQUEST_URL = "https://www.google.com/accounts/IssueAuthToken";
-static const LPSTR ISSUE_TOKEN_REQUEST_PARAMS = "SID=%s&LSID=%s&"
+const LPSTR ISSUE_TOKEN_REQUEST_URL = "https://www.google.com/accounts/IssueAuthToken";
+const LPSTR ISSUE_TOKEN_REQUEST_PARAMS = "SID=%s&LSID=%s&"
"Session=true&"
"skipvpage=true&"
"service=gaia";
-static const LPSTR TOKEN_AUTH_URL = "https://www.google.com/accounts/TokenAuth?"\
+const LPSTR TOKEN_AUTH_URL = "https://www.google.com/accounts/TokenAuth?"\
"auth=%s&"
"service=mail&"
"continue=%s&"
"source=googletalk";
-static const NETLIBHTTPHEADER HEADER_URL_ENCODED = {"Content-Type", "application/x-www-form-urlencoded"};
-static const int HTTP_OK = 200;
+const NETLIBHTTPHEADER HEADER_URL_ENCODED = {"Content-Type", "application/x-www-form-urlencoded"};
+const int HTTP_OK = 200;
-static const LPSTR SID_KEY_NAME = "SID=";
-static const LPSTR LSID_KEY_NAME = "LSID=";
+const LPSTR SID_KEY_NAME = "SID=";
+const LPSTR LSID_KEY_NAME = "LSID=";
-static const LPSTR LOGIN_PASS_SETTING_NAME = "LoginPassword";
+const LPSTR LOGIN_PASS_SETTING_NAME = "LoginPassword";
-static const LPTSTR INBOX_URL_FORMAT = _T("https://mail.google.com/%s%s/#inbox");
+const LPTSTR INBOX_URL_FORMAT = _T("https://mail.google.com/%s%s/#inbox");
-static const DWORD SIZE_OF_JABBER_OPTIONS = 243 * sizeof(DWORD);
+const DWORD SIZE_OF_JABBER_OPTIONS = 243 * sizeof(DWORD);
// 3 lines from netlib.h
#define GetNetlibHandleType(h) (h?*(int*)h:NLH_INVALID)
@@ -211,47 +211,24 @@ struct OPEN_URL_HEADER {
HANDLE FindNetUserHandle(LPCSTR acc)
{
IJabberInterface *ji = getJabberApi(acc);
- if (!ji) return NULL;
+ if (!ji)
+ return NULL;
- PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h
-
- PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h
- sizeof(PVOID) + // skip vtable ptr
- sizeof(PVOID) + // skip m_ThreadInfo
- SIZE_OF_JABBER_OPTIONS); // skip m_options
-
- for (int i=0; i < 100; i++) {
- __try {
- if (GetNetlibHandleType(*pResult) == NLH_USER)
- break;
- }
- __except (EXCEPTION_EXECUTE_HANDLER){
- }
- pResult++;
- }
-
- assert(GetNetlibHandleType(*pResult) == NLH_USER);
- return *pResult;
+ return ji->Net()->GetHandle();
}
void OpenUrlThread(void *param)
{
OPEN_URL_HEADER* data = (OPEN_URL_HEADER*)param;
- __try {
- HANDLE hUser = FindNetUserHandle(data->acc);
- if (!hUser || !AuthAndOpen(hUser, data->url, data->mailbox, data->pwd))
- ShellExecuteA(0, NULL, data->url, NULL, NULL, SW_SHOW);
- }
- __finally {
- free(data);
- }
+ HANDLE hUser = FindNetUserHandle(data->acc);
+ if (!hUser || !AuthAndOpen(hUser, data->url, data->mailbox, data->pwd))
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM)data->url);
}
void __forceinline DecryptString(LPSTR str, int len)
{
- for (--len; len >= 0; len--)
- {
+ for (--len; len >= 0; len--) {
const char c = str[len] ^ 0xc3;
if (c) str[len] = c;
}
@@ -312,7 +289,8 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
}
data->pwd = data->mailbox + mailboxLen;
- if (!GetMailboxPwd(acc, mailbox, &data->pwd, pwdLen)) return FALSE;
+ if (!GetMailboxPwd(acc, mailbox, &data->pwd, pwdLen))
+ return FALSE;
data->acc = acc;
@@ -328,63 +306,38 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
static void ShellExecuteThread(PVOID param)
{
- __try {
- ShellExecute(0, NULL, (LPTSTR)param, NULL, NULL, SW_SHOW);
- }
- __finally {
- free(param);
- }
-}
-
-void StartShellExecuteThread(LPCTSTR url)
-{
- mir_forkthread(ShellExecuteThread, _tcsdup(url));
+ CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)param);
+ mir_free(param);
}
void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
{
extern DWORD itlsSettings;
- if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (DWORD)TlsGetValue(itlsSettings)) ||
- !OpenUrlWithAuth(acc, mailbox, url))
- StartShellExecuteThread(url);
-}
-
-LPTSTR CraftInboxUrl(LPTSTR jid)
-{
- LPTSTR host = _tcsstr(jid, _T("@")) + 1;
-
- LPTSTR result = (LPTSTR)malloc((lstrlen(INBOX_URL_FORMAT) + 1 + lstrlen(jid)) * sizeof(TCHAR));
- __try {
- if (lstrcmpi(host, COMMON_GMAIL_HOST1) && lstrcmpi(host, COMMON_GMAIL_HOST2))
- wsprintf(result, INBOX_URL_FORMAT, _T("a/"), host); // hosted
- else
- wsprintf(result, INBOX_URL_FORMAT, NULL, _T("mail")); // common
- }
- __except (
- free(result),
- EXCEPTION_CONTINUE_SEARCH
- ) {}
-
- return result;
+ if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (DWORD)TlsGetValue(itlsSettings)) || !OpenUrlWithAuth(acc, mailbox, url))
+ mir_forkthread(ShellExecuteThread, mir_tstrdup(url));
}
void OpenContactInbox(HANDLE hContact)
{
LPSTR acc = GetContactProto(hContact);
- if (!acc) return;
+ if (!acc)
+ return;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(0, acc, "jid", &dbv))
- __try {
- LPTSTR url = CraftInboxUrl(dbv.ptszVal);
- __try {
- OpenUrl(acc, dbv.ptszVal, url);
- }
- __finally {
- free(url);
- }
- }
- __finally {
- DBFreeVariant(&dbv);
- }
+ if ( DBGetContactSettingTString(0, acc, "jid", &dbv))
+ return;
+
+ LPTSTR host = _tcschr(dbv.ptszVal, '@');
+ if (!host)
+ return;
+ *host++ = 0;
+
+ TCHAR buf[1024];
+ if (lstrcmpi(host, COMMON_GMAIL_HOST1) && lstrcmpi(host, COMMON_GMAIL_HOST2))
+ mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T("a/"), host); // hosted
+ else
+ mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T(""), _T("mail")); // common
+ OpenUrl(acc, dbv.ptszVal, buf);
+
+ DBFreeVariant(&dbv);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index ba9b9b14de..d4c75ca665 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -120,18 +120,13 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
UnhookEvent(hHook);
}
- __try {
- if (ppdh->MarkRead && ppdh->hDbEvent && (acc = GetJidAcc(ppdh->jid))) {
- ReadNotificationSettings(acc);
- MarkEventRead(ppdh->hContact, ppdh->hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)ppdh->hContact, (LPARAM)ppdh->hDbEvent);
- }
- }
- __finally {
- RemoveProp(wnd, PLUGIN_DATA_PROP_NAME);
- free(ppdh);
+ if (ppdh->MarkRead && ppdh->hDbEvent && (acc = GetJidAcc(ppdh->jid))) {
+ ReadNotificationSettings(acc);
+ MarkEventRead(ppdh->hContact, ppdh->hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)ppdh->hContact, (LPARAM)ppdh->hDbEvent);
}
-
+ RemoveProp(wnd, PLUGIN_DATA_PROP_NAME);
+ free(ppdh);
return 0;
case WM_LBUTTONUP:
@@ -158,20 +153,18 @@ static bool DoAddPopup(POPUPDATAT *data)
{
bool result = false;
HWND handle = 0;
- __try {
- if (ReadCheckbox(0, IDC_POPUPSINFULLSCREEN, (DWORD)TlsGetValue(itlsSettings))) {
- handle = CreateWindowEx(WS_EX_TOOLWINDOW, TEMP_WINDOW_CLASS_NAME, NULL, WS_OVERLAPPED | WS_VISIBLE,
+
+ if (ReadCheckbox(0, IDC_POPUPSINFULLSCREEN, (DWORD)TlsGetValue(itlsSettings))) {
+ handle = CreateWindowEx(WS_EX_TOOLWINDOW, TEMP_WINDOW_CLASS_NAME, NULL, WS_OVERLAPPED | WS_VISIBLE,
-100, -100, 10, 10, NULL, NULL, NULL, NULL);
- if (handle) {
- ShowWindow(handle, SW_MINIMIZE);
- ShowWindow(handle, SW_RESTORE);
- }
+ if (handle) {
+ ShowWindow(handle, SW_MINIMIZE);
+ ShowWindow(handle, SW_RESTORE);
}
- result = PUAddPopUpT(data) == 0;
- }
- __finally {
- if (handle) DestroyWindow(handle);
}
+ result = PUAddPopUpT(data) == 0;
+
+ if (handle) DestroyWindow(handle);
return result;
}
@@ -196,21 +189,15 @@ HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR
SetAvatar(result);
- BOOL allocateName = !displayName;
- __try {
- if (allocateName) {
- displayName = (LPCTSTR)malloc((lstrlen(jid) + lstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
- FormatPseudocontactDisplayName((LPTSTR)displayName, jid, unreadCount);
- }
-
- DBWriteContactSettingTString(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName);
- }
- __finally {
- if (allocateName) free((PVOID)displayName);
+ if (displayName == NULL) {
+ TCHAR *tszTemp = (TCHAR*)alloca((lstrlen(jid) + lstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR));
+ FormatPseudocontactDisplayName(tszTemp, jid, unreadCount);
+ db_set_ts(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, tszTemp);
}
+ else db_set_ts(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName);
- DBWriteContactSettingTString(result, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateTS(MAIL_NOTIFICATIONS));
- DBWriteContactSettingTString(result, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount);
+ db_set_ts(result, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateTS(MAIL_NOTIFICATIONS));
+ db_set_ts(result, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount);
return result;
}
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp
index 810dead8ec..07b533c0a2 100644
--- a/protocols/GTalkExt/src/options.cpp
+++ b/protocols/GTalkExt/src/options.cpp
@@ -40,7 +40,6 @@ static const LPTSTR TEST_LETTER_SNIP =
LPGENT("* No metaprogramming except preprocessor macros\n")
LPGENT("* No exceptions");
-HANDLE hOptionsHook = 0;
extern HINSTANCE g_hInst;
void CheckControlsEnabled(HWND wnd)
@@ -111,41 +110,41 @@ void SaveControls(HWND wnd, LPCSTR mod)
INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
- SetProp(wnd, ACCOUNT_PROP_NAME, (HANDLE)lParam);
- TranslateDialogDefault(wnd);
- ReadCheckboxes(wnd, (LPCSTR)lParam);
- CheckControlsEnabled(wnd);
- break;
-
- case WM_CTLCOLORSTATIC:
- if (GetDlgItem(wnd, IDC_WARNBAR) == (HWND)lParam)
- return (INT_PTR)CreateSolidBrush(0x55AAFF); // orange
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_POPUPSENABLED:
- case IDC_PSEUDOCONTACTENABLED:
- if (HIWORD(wParam) == BN_CLICKED) CheckControlsEnabled(wnd);
- // no break
-
- case IDC_CLEARPSEUDOCONTACTLOG:
- case IDC_POPUPSINFULLSCREEN:
- case IDC_MARKEVENTREAD:
- case IDC_AUTHONMAILBOX:
- case IDC_ADDSNIP:
- case IDC_UNKNOWNVIEW:
- case IDC_STANDARDVIEW:
- case IDC_HTMLVIEW:
- if (HIWORD(wParam) == BN_CLICKED) PropSheet_Changed(GetParent(wnd), wnd);
- }
- break;
-
- case WM_NOTIFY:
- if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
- SaveControls(wnd, (LPCSTR)GetProp(wnd, ACCOUNT_PROP_NAME));
- break;
+ case WM_INITDIALOG:
+ SetProp(wnd, ACCOUNT_PROP_NAME, (HANDLE)lParam);
+ TranslateDialogDefault(wnd);
+ ReadCheckboxes(wnd, (LPCSTR)lParam);
+ CheckControlsEnabled(wnd);
+ break;
+
+ case WM_CTLCOLORSTATIC:
+ if (GetDlgItem(wnd, IDC_WARNBAR) == (HWND)lParam)
+ return (INT_PTR)CreateSolidBrush(0x55AAFF); // orange
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_POPUPSENABLED:
+ case IDC_PSEUDOCONTACTENABLED:
+ if (HIWORD(wParam) == BN_CLICKED) CheckControlsEnabled(wnd);
+ // no break
+
+ case IDC_CLEARPSEUDOCONTACTLOG:
+ case IDC_POPUPSINFULLSCREEN:
+ case IDC_MARKEVENTREAD:
+ case IDC_AUTHONMAILBOX:
+ case IDC_ADDSNIP:
+ case IDC_UNKNOWNVIEW:
+ case IDC_STANDARDVIEW:
+ case IDC_HTMLVIEW:
+ if (HIWORD(wParam) == BN_CLICKED) PropSheet_Changed(GetParent(wnd), wnd);
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ SaveControls(wnd, (LPCSTR)GetProp(wnd, ACCOUNT_PROP_NAME));
+ break;
}
return 0;
}
@@ -181,58 +180,59 @@ void ShowTestPopup(HWND wnd)
INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(wnd);
- SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
- SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
-
- {LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
+ case WM_INITDIALOG:
+ TranslateDialogDefault(wnd);
+ SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_SETCOLOUR, 0,
+ (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
+ SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_SETCOLOUR, 0,
+ (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
+ {
+ LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
__try {
wsprintf(timeout, _T("%d"), DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_SETTEXT, 0, (LPARAM)timeout);
}
__finally {
free(timeout);
- }}
-
- SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE);
- break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_TESTBUTTON && HIWORD(wParam) == BN_CLICKED)
- ShowTestPopup(wnd);
-
- if (GetProp(wnd, DIALOG_INITIALIZED_PROP_NAME))
- switch (LOWORD(wParam)) {
- case IDC_BACKCOLORPICKER:
- case IDC_TEXTCOLORPICKER:
- if (HIWORD(wParam) == CPN_COLOURCHANGED) PropSheet_Changed(GetParent(wnd), wnd);
- break;
-
- case IDC_TIMEOUTEDIT:
- if (HIWORD(wParam) == EN_CHANGE) PropSheet_Changed(GetParent(wnd), wnd);
- }
- break;
-
- case WM_NOTIFY:
- if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
- DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING,
- (DWORD)SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_GETCOLOUR, 0, 0));
- DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING,
- (DWORD)SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_GETCOLOUR, 0, 0));
-
- int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1;
- LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR));
- __try {
- SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXT, len, (LPARAM)timeout);
- DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
- }
- __finally {
- free(timeout);
}
- break;
+ }
+
+ SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE);
+ break;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDC_TESTBUTTON && HIWORD(wParam) == BN_CLICKED)
+ ShowTestPopup(wnd);
+
+ if (GetProp(wnd, DIALOG_INITIALIZED_PROP_NAME))
+ switch (LOWORD(wParam)) {
+ case IDC_BACKCOLORPICKER:
+ case IDC_TEXTCOLORPICKER:
+ if (HIWORD(wParam) == CPN_COLOURCHANGED) PropSheet_Changed(GetParent(wnd), wnd);
+ break;
+
+ case IDC_TIMEOUTEDIT:
+ if (HIWORD(wParam) == EN_CHANGE) PropSheet_Changed(GetParent(wnd), wnd);
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING,
+ (DWORD)SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_GETCOLOUR, 0, 0));
+ DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING,
+ (DWORD)SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_GETCOLOUR, 0, 0));
+
+ int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1;
+ LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR));
+ __try {
+ SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXT, len, (LPARAM)timeout);
+ DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
+ }
+ __finally {
+ free(timeout);
+ }
+ break;
}
return 0;
}
@@ -253,8 +253,7 @@ void AddPopupsPage(WPARAM wParam)
void AddAccPage(LPTSTR acc, LPCSTR mod, WPARAM wParam)
{
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.ptszTitle = acc;
odp.pfnDlgProc = AccOptionsDlgProc;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS);
@@ -273,21 +272,14 @@ int OptionsInitialization(WPARAM wParam, LPARAM lParam)
PROTOACCOUNT **accs;
CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accs);
for (int i = 0; i < count; i++)
- if (getJabberApi(accs[i]->szModuleName)) AddAccPage(accs[i]->tszAccountName, accs[i]->szModuleName, wParam);
+ if ( getJabberApi(accs[i]->szModuleName))
+ AddAccPage(accs[i]->tszAccountName, accs[i]->szModuleName, wParam);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) AddPopupsPage(wParam);
return FALSE;
}
-BOOL HookOptionsInitialization()
+void HookOptionsInitialization()
{
- return (hOptionsHook = HookEvent(ME_OPT_INITIALISE, OptionsInitialization)) != 0;
+ HookEvent(ME_OPT_INITIALISE, OptionsInitialization);
}
-
-void UnhookOptionsInitialization()
-{
- if (hOptionsHook) {
- UnhookEvent(hOptionsHook);
- hOptionsHook = 0;
- }
-} \ No newline at end of file
diff --git a/protocols/GTalkExt/src/options.h b/protocols/GTalkExt/src/options.h
index 2b0c215dd3..ff9c2327e2 100644
--- a/protocols/GTalkExt/src/options.h
+++ b/protocols/GTalkExt/src/options.h
@@ -33,7 +33,6 @@ static const LPSTR BACK_COLOR_SETTING = "BackColor";
static const LPSTR TEXT_COLOR_SETTING = "TextColor";
static const LPSTR TIMEOUT_SETTING = "Timeout";
-BOOL HookOptionsInitialization();
-void UnhookOptionsInitialization();
+void HookOptionsInitialization();
DWORD ReadCheckboxes(HWND wnd, LPCSTR mod);
BOOL ReadCheckbox(HWND wnd, int id, DWORD controls); \ No newline at end of file
diff --git a/protocols/GTalkExt/src/resources.h b/protocols/GTalkExt/src/resources.h
index 547a3c7ee2..1b63b3c9e4 100644
--- a/protocols/GTalkExt/src/resources.h
+++ b/protocols/GTalkExt/src/resources.h
@@ -57,10 +57,3 @@
#define IDI_POPUP 3001
#define IDI_PSEUDOAVA 3002
-
-#define PLUGIN_VERSION_STRING "0.0.0.20 BETA"
-#define PLUGIN_FILE_VERSION 0, 0, 0, 20
-#define PLUGIN_VERSION_DWORD PLUGIN_MAKE_VERSION(0, 0, 0, 20)
-
-#define PLUGIN_DESCRIPTION "GTalk extensions for Jabber protocol"
-#define COPYRIGHT_STRING "2010, 11 bems"
diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h
index 7e272e900f..d89c4d59e7 100644
--- a/protocols/GTalkExt/src/stdafx.h
+++ b/protocols/GTalkExt/src/stdafx.h
@@ -61,6 +61,7 @@
#include <m_clist.h>
#include <m_avatars.h>
#include <m_netlib.h>
+#include <win2k.h>
#pragma warning(pop)
#if _MSC_VER < 1400
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index 5483f82aa3..cacdf5878e 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -87,8 +87,8 @@ void SetLabelProp(int index, LPSTR setting)
__try {
if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) {
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
- DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
- DBWriteContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, label);
+ db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
+ db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, label);
}
}
__finally {
@@ -137,7 +137,7 @@ void AddTipperItem()
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
- DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
+ db_set_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label);
WRITE_TIPPER_PROP(TString, 0, label);
WRITE_TIPPER_PROP(Byte, 1, 0);
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 1eedf528db..d6cc3803df 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -702,10 +702,6 @@ struct JabberAdHocData
TCHAR* ResponderJID;
};
-//---- jabber_std.cpp -------------------------------------------------------------------
-
-char* __fastcall JTranslate(const char* str);
-
//---- jabber_util.cpp ------------------------------------------------------------------
struct TStringPairsElem
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 9958742177..684d784dbe 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -682,9 +682,9 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact)
case PFLAGNUM_4:
return PF4_FORCEAUTH | PF4_NOCUSTOMAUTH | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDUTF | PF4_FORCEADDED;
case PFLAG_UNIQUEIDTEXT:
- return (DWORD_PTR) JTranslate("JID");
+ return (DWORD_PTR)Translate("JID");
case PFLAG_UNIQUEIDSETTING:
- return (DWORD_PTR) "jid";
+ return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
{
DBVARIANT dbv;
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 44c1e3352c..90ef79398a 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -102,30 +102,32 @@ struct CJabberSysInterface: public IJabberSysInterface
struct CJabberNetInterface: public IJabberNetInterface
{
- int STDMETHODCALLTYPE GetVersion() const; // Returns version of IJabberNetInterface.
- unsigned int STDMETHODCALLTYPE SerialNext(); // Returns id that can be used for next message sent through SendXmlNode().
- int STDMETHODCALLTYPE SendXmlNode(HXML node); // Sends XML node.
+ int STDMETHODCALLTYPE GetVersion() const; // Returns version of IJabberNetInterface.
+ UINT STDMETHODCALLTYPE SerialNext(); // Returns id that can be used for next message sent through SendXmlNode().
+ int STDMETHODCALLTYPE SendXmlNode(HXML node); // Sends XML node.
// In all incoming stanza handlers, return TRUE to continue processing of the stanza (Jabber plugin will then call other handlers). Return FALSE only when you're sure noone else will need to process this stanza.
// Registers incoming <presence/> handler. Returns handler handle on success or NULL on error.
- HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddPresenceHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
// Registers incoming <message/> handler for messages of types specified by iMsgTypes. iMsgTypes is a combination of JABBER_MESSAGE_TYPE_* flags. Returns handler handle on success or NULL on error.
- HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddMessageHandler(JABBER_HANDLER_FUNC Func, int iMsgTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
// Registers incoming <iq/> handler. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error.
- HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, LPCTSTR szXmlns, LPCTSTR szTag, void *pUserData, int iPriority);
// Registers temporary handler for incoming <iq/> stanza of type iIqType with id iIqId. iIqTypes is a combination of JABBER_IQ_TYPE_* flags. Returns handler handle on success or NULL on error. You must free pUserData in the handler by yourself.
- HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddTemporaryIqHandler(JABBER_HANDLER_FUNC Func, int iIqTypes, int iIqId, void *pUserData, DWORD dwTimeout, int iPriority);
// Registers handler for outgoing nodes. The handler may modify the node if it's necessary. Return TRUE in the handler to continue, or FALSE to abort sending.
- HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
+ HJHANDLER STDMETHODCALLTYPE AddSendHandler(JABBER_HANDLER_FUNC Func, void *pUserData, int iPriority);
// Unregisters handler by its handle.
- int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler);
-
- int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription); // Registers feature so that it's displayed with proper description in other users' details. Call this function in your ME_SYSTEM_MODULESLOADED handler. Returns TRUE on success or FALSE on error.
- int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
- int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client.
- LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
+ int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler);
+
+ // Registers feature so that it's displayed with proper description in other users' details. Call this function in your ME_SYSTEM_MODULESLOADED handler. Returns TRUE on success or FALSE on error.
+ int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription);
+ int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
+ int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client.
+ LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
+ HANDLE STDMETHODCALLTYPE GetHandle(); // Returns connection handle
CJabberProto *m_psProto;
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 5aacd4cc11..9d4ae894fd 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -202,16 +202,10 @@ DWORD CJabberProto::JSetWord(HANDLE hContact, const char* valueName, int parValu
return db_set_w(hContact, m_szModuleName, valueName, parValue);
}
-char* __fastcall JTranslate(const char* str)
-{
- return Translate(str);
-}
-
// save/load crypted strings
void __forceinline sttCryptString(char *str)
{
- for (;*str; ++str)
- {
+ for (;*str; ++str) {
const char c = *str ^ 0xc3;
if (c) *str = c;
}
@@ -220,14 +214,11 @@ void __forceinline sttCryptString(char *str)
TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName)
{
DBVARIANT dbv;
-
if ( DBGetContactSettingString(hContact, m_szModuleName, valueName, &dbv))
return NULL;
sttCryptString(dbv.pszVal);
WCHAR *res = mir_utf8decodeW(dbv.pszVal);
-
-
db_free(&dbv);
return res;
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index 0e1e12c2b2..fa1ebe4188 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -1131,3 +1131,8 @@ LPTSTR CJabberNetInterface::GetResourceFeatures(LPCTSTR jid)
}
return NULL;
}
+
+HANDLE CJabberNetInterface::GetHandle()
+{
+ return m_psProto->m_hNetlibUser;
+}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index eb0e65926f..7edfdb49b2 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -381,7 +381,8 @@ LBL_FatalError:
_tcsncpy(info->password, passw, SIZEOF(info->password));
info->password[SIZEOF(info->password)-1] = '\0';
mir_free(passw);
- } }
+ }
+ }
else if (info->type == JABBER_SESSION_REGISTER) {
// Register new user connection, all connection parameters are already filled-in.