diff options
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 4 | ||||
-rw-r--r-- | protocols/WhatsApp/src/contacts.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.cpp | 14 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.h | 11 | ||||
-rw-r--r-- | protocols/WhatsApp/src/theme.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/utils.h | 29 |
7 files changed, 18 insertions, 46 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index e365a93e62..27d1cc3b22 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -2,12 +2,12 @@ // #TODO Remove, as we are not using the chat-module for groups anymore
-int WhatsAppProto::OnJoinChat(WPARAM,LPARAM)
+INT_PTR WhatsAppProto::OnJoinChat(WPARAM,LPARAM)
{
return 0;
}
-int WhatsAppProto::OnLeaveChat(WPARAM,LPARAM)
+INT_PTR WhatsAppProto::OnLeaveChat(WPARAM,LPARAM)
{
return 0;
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 0e459f8d85..6a0c3108c6 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -662,7 +662,7 @@ void WhatsAppProto::onGroupCreated(const std::string& paramString1, const std::s }
// Menu-handler
-int __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam)
+INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam)
{
LOG("");
input_box* ib = new input_box;
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index c1e4807a17..605537cb6d 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -180,7 +180,7 @@ INT_PTR CALLBACK WhatsAppInputBoxProc( HWND hwnd, UINT message, WPARAM wparam, L ret->userData = ib->userData;
ret->value = mir_utf8encodeT(value);
delete value;
- ForkThread(ib->thread, ib->proto, ret);
+ ib->proto->ForkThread(ib->thread, ret);
EndDialog(hwnd, wparam);
delete ib;
return TRUE;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index bd74705bce..5a6cab3f85 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -10,12 +10,12 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) : update_loop_lock_ = CreateEvent(NULL, false, false, NULL);
FMessage::generating_lock = new Mutex();
- CreateProtoService(m_szModuleName, PS_CREATEACCMGRUI, &WhatsAppProto::SvcCreateAccMgrUI, this);
- CreateProtoService(m_szModuleName, PS_JOINCHAT, &WhatsAppProto::OnJoinChat, this);
- CreateProtoService(m_szModuleName, PS_LEAVECHAT, &WhatsAppProto::OnLeaveChat, this);
+ CreateService(PS_CREATEACCMGRUI, &WhatsAppProto::SvcCreateAccMgrUI);
+ CreateService(PS_JOINCHAT, &WhatsAppProto::OnJoinChat);
+ CreateService(PS_LEAVECHAT, &WhatsAppProto::OnLeaveChat);
- HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu, this);
- HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::OnChatOutgoing, this);
+ HookEvent(ME_GC_EVENT, &WhatsAppProto::OnChatOutgoing);
+ HookEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu);
this->InitContactMenus();
@@ -279,9 +279,9 @@ string WhatsAppProto::Register(int state, string cc, string number, string code) //////////////////////////////////////////////////////////////////////////////
// EVENTS
-int WhatsAppProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
+INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam)
{
- return (int)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_WHATSAPPACCOUNT),
+ return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_WHATSAPPACCOUNT),
(HWND)lParam, WhatsAppAccountProc, (LPARAM)this );
}
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index d8365501cc..a143922df5 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -81,16 +81,17 @@ public: ////////////////////////
// Services
- int __cdecl SvcCreateAccMgrUI( WPARAM, LPARAM);
- int __cdecl RefreshBuddyList(WPARAM, LPARAM);
+ INT_PTR __cdecl SvcCreateAccMgrUI( WPARAM, LPARAM);
+ INT_PTR __cdecl OnJoinChat(WPARAM, LPARAM);
+ INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM);
+ INT_PTR __cdecl OnCreateGroup(WPARAM,LPARAM);
+
+ int __cdecl RefreshBuddyList(WPARAM, LPARAM);
int __cdecl RequestFriendship(WPARAM, LPARAM);
- int __cdecl OnJoinChat(WPARAM, LPARAM);
- int __cdecl OnLeaveChat(WPARAM, LPARAM);
// Events
int __cdecl OnBuildStatusMenu(WPARAM,LPARAM);
int __cdecl OnChatOutgoing(WPARAM,LPARAM);
- int __cdecl OnCreateGroup(WPARAM,LPARAM);
int __cdecl OnPrebuildContactMenu(WPARAM,LPARAM);
INT_PTR __cdecl OnAddContactToGroup(WPARAM, LPARAM, LPARAM);
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 0e277544a4..b293efe719 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -253,7 +253,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) mi.flags = CMIF_CHILDPOPUP | ( this->isOnline() ? 0 : CMIF_GRAYED );
mi.position = 201001;
- CreateProtoService(m_szModuleName, "/CreateGroup", &WhatsAppProto::OnCreateGroup, this);
+ CreateService("/CreateGroup", &WhatsAppProto::OnCreateGroup);
strcpy(tDest, "/CreateGroup");
mi.hParentMenu = hRoot;
mi.pszName = LPGEN("Create Group");
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h index b5430bcfa9..ece8dafaf3 100644 --- a/protocols/WhatsApp/src/utils.h +++ b/protocols/WhatsApp/src/utils.h @@ -3,35 +3,6 @@ #include "WhatsAPI++/IMutex.h"
-template<typename T>
-void CreateProtoService(const char *module,const char *service,
- int (__cdecl T::*serviceProc)(WPARAM,LPARAM),T *self)
-{
- char temp[MAX_PATH*2];
-
- mir_snprintf(temp,sizeof(temp),"%s%s",module,service);
- CreateServiceFunctionObj(temp,( MIRANDASERVICEOBJ )*(void**)&serviceProc, self );
-}
-
-template<typename T>
-void HookProtoEvent(const char* evt, int (__cdecl T::*eventProc)(WPARAM,LPARAM), T *self)
-{
- ::HookEventObj(evt,(MIRANDAHOOKOBJ)*(void**)&eventProc,self);
-}
-
-template<typename T>
-HANDLE ForkThreadEx(void (__cdecl T::*thread)(void*),T *self,void *data = 0)
-{
- return reinterpret_cast<HANDLE>( mir_forkthreadowner(
- (pThreadFuncOwner)*(void**)&thread,self,data,0));
-}
-
-template<typename T>
-void ForkThread(void (__cdecl T::*thread)(void*),T *self,void *data = 0)
-{
- CloseHandle(ForkThreadEx(thread,self,data));
-}
-
class ScopedLock
{
public:
|