summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-16 11:50:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-16 11:50:15 +0000
commit5161fd3fe53b85f579cfece81e25b562f1fa56ae (patch)
tree3ac6979cd3774351cb68431da64ca014f1170e98 /src
parentce6e5ab03d58151c4eda36d05a8436d337b2d3c0 (diff)
- event code standardization for protocols
- fix for EVENTTYPE_AUTHREQUEST processing - protocols' custom CallService core removed git-svn-id: http://svn.miranda-ng.org/main/trunk@1576 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdauth/auth.cpp16
-rw-r--r--src/core/stdfile/file.cpp2
-rw-r--r--src/modules/protocols/protocols.cpp17
3 files changed, 26 insertions, 9 deletions
diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp
index 9146653db8..e124c10bbf 100644
--- a/src/core/stdauth/auth.cpp
+++ b/src/core/stdauth/auth.cpp
@@ -2,8 +2,8 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
+Copyright 2000-2009 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
listed in contributors.txt.
This program is free software; you can redistribute it and/or
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -49,14 +49,14 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
DBEVENTINFO dbei = {0};
dbei.cbSize = sizeof(dbei);
CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&dbei);
- if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED))
+ if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED))
return 0;
dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, lParam, 0);
dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
CallService(MS_DB_EVENT_GET, lParam, (LPARAM)&dbei);
- HANDLE hContact = *(PHANDLE)(dbei.pBlob + sizeof(DWORD));
+ HANDLE hContact = DbGetAuthEventContact(&dbei);
CLISTEVENT cli = {0};
cli.cbSize = sizeof(cli);
@@ -89,7 +89,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
if (szUid[0])
mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s requests authorization"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *((PDWORD)dbei.pBlob));
+ mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
cli.hIcon = LoadSkinIcon(SKINICON_OTHER_MIRANDA);
cli.pszService = MS_AUTH_SHOWREQUEST;
@@ -100,7 +100,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
if (szUid[0])
mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%s added you to their contact list"), szUid);
else
- mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *((PDWORD)dbei.pBlob));
+ mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
cli.hIcon = LoadSkinIcon(SKINICON_OTHER_MIRANDA);
cli.pszService = MS_AUTH_SHOWADDED;
@@ -119,4 +119,4 @@ int LoadSendRecvAuthModule(void)
SkinAddNewSoundEx("AddedEvent", LPGEN("Alerts"), LPGEN("Added event"));
return 0;
-}
+}
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp
index aff4fcbfa3..a7088ac378 100644
--- a/src/core/stdfile/file.cpp
+++ b/src/core/stdfile/file.cpp
@@ -467,7 +467,7 @@ int LoadSendRecvFileModule(void)
HookEvent(ME_OPT_INITIALISE, FileOptInitialise);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRFilePreBuildMenu);
- CreateServiceFunction(MS_PROTO_RECVFILE, Proto_RecvFile);
+ CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFile);
CreateServiceFunction(MS_PROTO_RECVFILET, Proto_RecvFileT);
CreateServiceFunction(MS_FILE_SENDFILE, SendFileCommand);
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 7c15f1de39..fb3c33e644 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -177,6 +177,22 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam)
return CallService(MS_DB_EVENT_ADD, (WPARAM) ccs->hContact, (LPARAM)&dbei);
}
+static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam)
+{
+ PROTORECVEVENT* pre = (PROTORECVEVENT*)lParam;
+
+ DBEVENTINFO dbei = { 0 };
+ dbei.cbSize = sizeof(dbei);
+ dbei.szModule = (char*)wParam;
+ dbei.timestamp = pre->timestamp;
+ dbei.flags = pre->flags & (PREF_CREATEREAD?DBEF_READ:0);
+ dbei.flags |= (pre->flags & PREF_UTF) ? DBEF_UTF : 0;
+ dbei.eventType = EVENTTYPE_AUTHREQUEST;
+ dbei.cbBlob = pre->lParam;
+ dbei.pBlob = (PBYTE)pre->szMessage;
+ return CallService(MS_DB_EVENT_ADD,(WPARAM)NULL,(LPARAM)&dbei);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// User Typing Notification services
@@ -700,6 +716,7 @@ int LoadProtocolsModule(void)
CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping);
CreateServiceFunction(MS_PROTO_RECVMSG, Proto_RecvMessage);
+ CreateServiceFunction(MS_PROTO_AUTHRECV, Proto_AuthRecv);
CreateServiceFunction("Proto/EnumProtocols", Proto_EnumAccounts);
CreateServiceFunction(MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts);