summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 20:47:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 20:47:51 +0000
commit68d3fd47bb9b75e65859d14199ffee01f16ac9a7 (patch)
treefcc340ad7067561e57733b287f193a7dbed93dd4 /protocols/WhatsApp
parent7193759b046338c6f47ff2edb34743a1465791cd (diff)
HCONTACT is not needed anymore
git-svn-id: http://svn.miranda-ng.org/main/trunk@8086 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/chat.cpp2
-rw-r--r--protocols/WhatsApp/src/contacts.cpp78
-rw-r--r--protocols/WhatsApp/src/entities.h8
-rw-r--r--protocols/WhatsApp/src/messages.cpp12
-rw-r--r--protocols/WhatsApp/src/proto.cpp12
-rw-r--r--protocols/WhatsApp/src/proto.h64
-rw-r--r--protocols/WhatsApp/src/theme.cpp18
7 files changed, 97 insertions, 97 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 81fd154153..bef230ecfd 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -35,7 +35,7 @@ int WhatsAppProto::OnChatOutgoing(WPARAM wParam, LPARAM lParam)
mir_free(id);
if (isOnline()) {
- HCONTACT hContact = this->ContactIDToHContact(chat_id);
+ MCONTACT hContact = this->ContactIDToHContact(chat_id);
if (hContact)
{
debugLogA("**Chat - Outgoing message: %s", text);
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index d3cf75690c..49cdca0982 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-bool WhatsAppProto::IsMyContact(HCONTACT hContact, bool include_chat)
+bool WhatsAppProto::IsMyContact(MCONTACT hContact, bool include_chat)
{
const char *proto = GetContactProto(hContact);
if( proto && strcmp(m_szModuleName,proto) == 0 )
@@ -14,10 +14,10 @@ bool WhatsAppProto::IsMyContact(HCONTACT hContact, bool include_chat)
return false;
}
-HCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool dont_check, const char *new_name,
+MCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool dont_check, const char *new_name,
bool isChatRoom, bool isHidden)
{
- HCONTACT hContact;
+ MCONTACT hContact;
if (!dont_check) {
// First, check if this contact exists
@@ -55,7 +55,7 @@ HCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool
}
// If not, make a new contact!
- hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
if (hContact)
{
if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName) == 0)
@@ -111,20 +111,20 @@ HCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool
else CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
}
- return (HCONTACT)INVALID_HANDLE_VALUE;
+ return (MCONTACT)INVALID_HANDLE_VALUE;
}
-HCONTACT WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
+MCONTACT WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
{
// Cache
- std::map<string, HCONTACT>::iterator it = this->hContactByJid.find(phoneNumber);
+ std::map<string, MCONTACT>::iterator it = this->hContactByJid.find(phoneNumber);
if (it != this->hContactByJid.end())
return it->second;
const char* idForContact = "ID";
const char* idForChat = "ChatRoomID";
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (!IsMyContact(hContact, true))
continue;
@@ -147,7 +147,7 @@ HCONTACT WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber)
void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client)
{
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (!IsMyContact(hContact))
continue;
@@ -171,7 +171,7 @@ void WhatsAppProto::ProcessBuddyList(void*)
{
std::vector<std::string> jids;
DBVARIANT dbv;
- for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (!IsMyContact(hContact))
continue;
@@ -219,7 +219,7 @@ void WhatsAppProto::SearchAckThread(void *targ)
void WhatsAppProto::onAvailable(const std::string& paramString, bool paramBoolean)
{
- HCONTACT hContact = this->AddToContactList(paramString, 0, false);
+ MCONTACT hContact = this->AddToContactList(paramString, 0, false);
if (hContact != NULL)
{
if (paramBoolean)
@@ -246,7 +246,7 @@ void WhatsAppProto::onAvailable(const std::string& paramString, bool paramBoolea
void WhatsAppProto::onLastSeen(const std::string& paramString1, int paramInt, std::string* paramString2)
{
/*
- HCONTACT hContact = this->ContactIDToHContact(paramString1);
+ MCONTACT hContact = this->ContactIDToHContact(paramString1);
if (hContact == NULL)
{
// This contact was searched
@@ -262,13 +262,13 @@ void WhatsAppProto::onLastSeen(const std::string& paramString1, int paramInt, st
// #TODO
}
*/
- HCONTACT hContact = this->AddToContactList(paramString1, 0, false);
+ MCONTACT hContact = this->AddToContactList(paramString1, 0, false);
setDword(hContact, WHATSAPP_KEY_LAST_SEEN, paramInt);
this->UpdateStatusMsg(hContact);
}
-void WhatsAppProto::UpdateStatusMsg(HCONTACT hContact)
+void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact)
{
std::wstringstream ss;
@@ -304,7 +304,7 @@ void WhatsAppProto::onPictureChanged(const std::string& from, const std::string&
void WhatsAppProto::onSendGetPicture(const std::string& jid, const std::vector<unsigned char>& data, const std::string& oldId, const std::string& newId)
{
- HCONTACT hContact = this->ContactIDToHContact(jid);
+ MCONTACT hContact = this->ContactIDToHContact(jid);
if (hContact)
{
debugLogA("Updating avatar for jid %s", jid.c_str());
@@ -342,7 +342,7 @@ void WhatsAppProto::onSendGetPictureIds(std::map<string,string>* ids)
{
for (std::map<string,string>::iterator it = ids->begin(); it != ids->end(); ++it)
{
- HCONTACT hContact = this->AddToContactList(it->first);
+ MCONTACT hContact = this->AddToContactList(it->first);
if (hContact != NULL)
{
DBVARIANT dbv;
@@ -365,14 +365,14 @@ void WhatsAppProto::onSendGetPictureIds(std::map<string,string>* ids)
}
}
-string WhatsAppProto::GetContactDisplayName(HCONTACT hContact)
+string WhatsAppProto::GetContactDisplayName(MCONTACT hContact)
{
return string((CHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
}
string WhatsAppProto::GetContactDisplayName(const string& jid)
{
- HCONTACT hContact = this->ContactIDToHContact(jid);
+ MCONTACT hContact = this->ContactIDToHContact(jid);
return hContact ? this->GetContactDisplayName(hContact) : (string("+")+ Utilities::removeWaDomainFromJid(jid));
}
@@ -389,7 +389,7 @@ void WhatsAppProto::SendGetGroupInfoWorker(void* data)
void WhatsAppProto::onGroupInfo(const std::string& gjid, const std::string& ownerJid, const std::string& subject, const std::string& createrJid, int paramInt1, int paramInt2)
{
debugLogA("'%s', '%s', '%s', '%s'", gjid.c_str(), ownerJid.c_str(), subject.c_str(), createrJid.c_str());
- HCONTACT hContact = ContactIDToHContact(gjid);
+ MCONTACT hContact = ContactIDToHContact(gjid);
if (!hContact)
{
debugLogA("Group info requested for non existing contact '%s'", gjid.c_str());
@@ -409,13 +409,13 @@ void WhatsAppProto::onGroupInfoFromList(const std::string& paramString1, const s
void WhatsAppProto::onGroupNewSubject(const std::string& from, const std::string& author, const std::string& newSubject, int paramInt)
{
debugLogA("'%s', '%s', '%s'", from.c_str(), author.c_str(), newSubject.c_str());
- HCONTACT hContact = this->AddToContactList(from, 0, false, newSubject.c_str(), true);
+ MCONTACT hContact = this->AddToContactList(from, 0, false, newSubject.c_str(), true);
}
void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::string& paramString2)
{
debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str());
- HCONTACT hContact = this->AddToContactList(paramString1);
+ MCONTACT hContact = this->AddToContactList(paramString1);
std::string groupName(this->GetContactDisplayName(hContact));
if (paramString2.compare(this->jid) == 0)
@@ -438,7 +438,7 @@ void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::s
void WhatsAppProto::onGroupRemoveUser(const std::string& paramString1, const std::string& paramString2)
{
debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str());
- HCONTACT hContact = this->ContactIDToHContact(paramString1);
+ MCONTACT hContact = this->ContactIDToHContact(paramString1);
if (!hContact)
return;
@@ -465,7 +465,7 @@ void WhatsAppProto::onLeaveGroup(const std::string& paramString)
{
// Won't be called for unknown reasons!
debugLogA("%s", this->GetContactDisplayName(paramString).c_str());
- HCONTACT hContact = this->ContactIDToHContact(paramString);
+ MCONTACT hContact = this->ContactIDToHContact(paramString);
if (hContact)
setByte(hContact, "IsGroupMember", 0);
}
@@ -474,7 +474,7 @@ void WhatsAppProto::onGetParticipants(const std::string& gjid, const std::vector
{
debugLogA("%s", this->GetContactDisplayName(gjid).c_str());
- HCONTACT hUserContact, hContact = this->ContactIDToHContact(gjid);
+ MCONTACT hUserContact, hContact = this->ContactIDToHContact(gjid);
if (!hContact)
return;
@@ -525,8 +525,8 @@ void WhatsAppProto::onGetParticipants(const std::string& gjid, const std::vector
// Menu handler
INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM lParam)
{
- string a = GetContactDisplayName((HCONTACT)wParam);
- string b = GetContactDisplayName((HCONTACT)lParam);
+ string a = GetContactDisplayName((MCONTACT)wParam);
+ string b = GetContactDisplayName((MCONTACT)lParam);
debugLogA("Request add user %s to group %s", a.c_str(), b.c_str());
if (!this->isOnline())
@@ -534,14 +534,14 @@ INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM
DBVARIANT dbv;
- if (getString((HCONTACT)wParam, "ID", &dbv))
+ if (getString((MCONTACT)wParam, "ID", &dbv))
return NULL;
std::vector<string> participants;
participants.push_back(string(dbv.pszVal));
db_free(&dbv);
- if (getString((HCONTACT)lParam, "ID", &dbv))
+ if (getString((MCONTACT)lParam, "ID", &dbv))
return NULL;
this->connection->sendAddParticipants(string(dbv.pszVal), participants);
@@ -553,8 +553,8 @@ INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM
// Menu handler
INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, LPARAM lParam)
{
- string a = GetContactDisplayName((HCONTACT)wParam);
- string b = GetContactDisplayName((HCONTACT)lParam);
+ string a = GetContactDisplayName((MCONTACT)wParam);
+ string b = GetContactDisplayName((MCONTACT)lParam);
debugLogA("Request remove user %s from group %s", a.c_str(), b.c_str());
if (!this->isOnline())
@@ -562,14 +562,14 @@ INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, L
DBVARIANT dbv;
- if (getString((HCONTACT)lParam, "ID", &dbv))
+ if (getString((MCONTACT)lParam, "ID", &dbv))
return NULL;
std::vector<string> participants;
participants.push_back(string(dbv.pszVal));
db_free(&dbv);
- if (getString((HCONTACT)wParam, "ID", &dbv))
+ if (getString((MCONTACT)wParam, "ID", &dbv))
return NULL;
this->connection->sendRemoveParticipants(string(dbv.pszVal), participants);
@@ -592,8 +592,8 @@ void WhatsAppProto::onParticipatingGroups(const std::vector<string>& paramVector
void WhatsAppProto::HandleReceiveGroups(const std::vector<string>& groups, bool isOwned)
{
- HCONTACT hContact;
- map<HCONTACT, bool> isMember; // at the moment, only members of owning groups are stored
+ MCONTACT hContact;
+ map<MCONTACT, bool> isMember; // at the moment, only members of owning groups are stored
// This could take long time if there are many new groups which aren't
// yet stored to the database. But that should be a rare case
@@ -632,7 +632,7 @@ void WhatsAppProto::onGroupCreated(const std::string& paramString1, const std::s
// Must be received after onOwningGroups() :/
debugLogA("%s / %s", paramString1.c_str(), paramString2.c_str());
string jid = paramString2 +string("@")+ paramString1;
- HCONTACT hContact = this->AddToContactList(jid, 0, false, NULL, true);
+ MCONTACT hContact = this->AddToContactList(jid, 0, false, NULL, true);
setByte(hContact, "SimpleChatRoom", 2);
}
@@ -659,7 +659,7 @@ void __cdecl WhatsAppProto::SendSetGroupNameWorker(void* data)
string groupName(ibr->value);
mir_free(ibr->value);
DBVARIANT dbv;
- if (!getString(*((HCONTACT*)ibr->userData), WHATSAPP_KEY_ID, &dbv) && this->isOnline())
+ if (!getString(*((MCONTACT*)ibr->userData), WHATSAPP_KEY_ID, &dbv) && this->isOnline())
{
this->connection->sendSetNewSubject(dbv.pszVal, groupName);
db_free(&dbv);
@@ -682,7 +682,7 @@ void __cdecl WhatsAppProto::SendCreateGroupWorker(void* data)
INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv;
- HCONTACT hContact = HCONTACT(wParam);
+ MCONTACT hContact = MCONTACT(wParam);
input_box* ib = new input_box;
if (getTString(hContact, WHATSAPP_KEY_PUSH_NAME, &dbv))
@@ -698,7 +698,7 @@ INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM wParam, LPARAM lParam
ib->thread = &WhatsAppProto::SendSetGroupNameWorker;
ib->proto = this;
- HCONTACT *hContactPtr = new HCONTACT(hContact);
+ MCONTACT *hContactPtr = new MCONTACT(hContact);
ib->userData = (void*)hContactPtr;
HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_INPUTBOX), 0, WhatsAppInputBoxProc,
@@ -710,7 +710,7 @@ INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM wParam, LPARAM lParam
INT_PTR __cdecl WhatsAppProto::OnLeaveGroup(WPARAM wParam, LPARAM)
{
DBVARIANT dbv;
- HCONTACT hContact = HCONTACT(wParam);
+ MCONTACT hContact = MCONTACT(wParam);
if (this->isOnline() && !getString(hContact, WHATSAPP_KEY_ID, &dbv))
{
setByte(hContact, "IsGroupMember", 0);
diff --git a/protocols/WhatsApp/src/entities.h b/protocols/WhatsApp/src/entities.h
index a2543cf20d..2be8cacd54 100644
--- a/protocols/WhatsApp/src/entities.h
+++ b/protocols/WhatsApp/src/entities.h
@@ -3,18 +3,18 @@
struct send_direct
{
- send_direct(HCONTACT hContact,const std::string &msg, HANDLE msgid, bool isChat = false)
+ send_direct(MCONTACT hContact,const std::string &msg, HANDLE msgid, bool isChat = false)
: hContact(hContact), msg(msg), msgid(msgid)
{}
- HCONTACT hContact;
+ MCONTACT hContact;
std::string msg;
HANDLE msgid;
};
struct send_typing
{
- send_typing(HCONTACT hContact,const int status) : hContact(hContact), status(status) {}
- HCONTACT hContact;
+ send_typing(MCONTACT hContact,const int status) : hContact(hContact), status(status) {}
+ MCONTACT hContact;
int status;
};
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp
index c5c911ade8..b051d20903 100644
--- a/protocols/WhatsApp/src/messages.cpp
+++ b/protocols/WhatsApp/src/messages.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-int WhatsAppProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre)
+int WhatsAppProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
{
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -28,7 +28,7 @@ void WhatsAppProto::onMessageForMe(FMessage* paramFMessage, bool paramBoolean)
msg->insert(0, std::string("[").append(paramFMessage->notifyname).append("]: "));
}
- HCONTACT hContact = this->AddToContactList(paramFMessage->key->remote_jid, 0, false,
+ MCONTACT hContact = this->AddToContactList(paramFMessage->key->remote_jid, 0, false,
isChatRoom ? NULL : paramFMessage->notifyname.c_str(), isChatRoom);
PROTORECVEVENT recv = {0};
@@ -40,7 +40,7 @@ void WhatsAppProto::onMessageForMe(FMessage* paramFMessage, bool paramBoolean)
this->connection->sendMessageReceived(paramFMessage);
}
-int WhatsAppProto::SendMsg(HCONTACT hContact, int flags, const char *msg)
+int WhatsAppProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
{
debugLogA("");
int msgId = ++(this->msgId);
@@ -120,7 +120,7 @@ void WhatsAppProto::RecvMsgWorker(void *p)
void WhatsAppProto::onIsTyping(const std::string& paramString, bool paramBoolean)
{
- HCONTACT hContact = this->AddToContactList(paramString, 0, false);
+ MCONTACT hContact = this->AddToContactList(paramString, 0, false);
if (hContact != NULL)
{
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, (LPARAM)
@@ -129,7 +129,7 @@ void WhatsAppProto::onIsTyping(const std::string& paramString, bool paramBoolean
}
-int WhatsAppProto::UserIsTyping(HCONTACT hContact,int type)
+int WhatsAppProto::UserIsTyping(MCONTACT hContact,int type)
{
if (hContact && isOnline())
ForkThread(&WhatsAppProto::SendTypingWorker, new send_typing(hContact, type));
@@ -165,7 +165,7 @@ void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg)
{
debugLogA("");
- HCONTACT hContact = this->ContactIDToHContact(fmsg->key->remote_jid);
+ MCONTACT hContact = this->ContactIDToHContact(fmsg->key->remote_jid);
if (hContact == 0)
return;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 1430969639..4b142f0d47 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -61,7 +61,7 @@ int WhatsAppProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam)
return 0;
}
-DWORD_PTR WhatsAppProto::GetCaps( int type, HCONTACT hContact )
+DWORD_PTR WhatsAppProto::GetCaps( int type, MCONTACT hContact )
{
switch(type)
{
@@ -134,12 +134,12 @@ int WhatsAppProto::SetStatus( int new_status )
return 0;
}
-HCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
+MCONTACT WhatsAppProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
{
return NULL;
}
-int WhatsAppProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message)
+int WhatsAppProto::AuthRequest(MCONTACT hContact,const PROTOCHAR *message)
{
return this->RequestFriendship((WPARAM)hContact, NULL);
}
@@ -314,7 +314,7 @@ int WhatsAppProto::RequestFriendship(WPARAM wParam, LPARAM lParam)
if (wParam == NULL || isOffline())
return 0;
- HCONTACT hContact = HCONTACT(wParam);
+ MCONTACT hContact = MCONTACT(wParam);
DBVARIANT dbv;
if ( !getString(hContact, WHATSAPP_KEY_ID, &dbv))
@@ -363,7 +363,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return DefWindowProc(hwnd, message, wParam, lParam);
};
-void WhatsAppProto::NotifyEvent(const string& title, const string& info, HCONTACT contact, DWORD flags, TCHAR* url)
+void WhatsAppProto::NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, TCHAR* url)
{
TCHAR* rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8);
TCHAR* rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8);
@@ -372,7 +372,7 @@ void WhatsAppProto::NotifyEvent(const string& title, const string& info, HCONTAC
mir_free(rawInfo);
}
-void WhatsAppProto::NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, TCHAR* szUrl)
+void WhatsAppProto::NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, TCHAR* szUrl)
{
int ret; int timeout; COLORREF colorBack = 0; COLORREF colorText = 0;
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 5b1862464a..4e0d36db42 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -32,23 +32,23 @@ public:
//PROTO_INTERFACE
- virtual HCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
- virtual HCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; }
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
+ virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; }
virtual int __cdecl Authorize( HANDLE hDbEvent );
virtual int __cdecl AuthDeny( HANDLE hDbEvent, const PROTOCHAR* szReason ) { return 1; }
- virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ) { return 1; }
- virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage );
+ virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage );
virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ) { return NULL; }
- virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return NULL; }
- virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ) { return 1; }
- virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; }
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return NULL; }
+ virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer ) { return 1; }
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; }
virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) { return 1; }
- virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL );
- virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ) { return 1; }
+ virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL );
+ virtual int __cdecl GetInfo(MCONTACT hContact, int infoType ) { return 1; }
virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id );
virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ) { return NULL; }
@@ -56,25 +56,25 @@ public:
virtual HWND __cdecl SearchAdvanced( HWND owner ) { return NULL; }
virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ) { return NULL; }
- virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* ) { return 1; }
- virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT* ) { return 1; }
- virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* );
- virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT* ) { return 1; }
+ virtual int __cdecl RecvFile(MCONTACT hContact, PROTOFILEEVENT* ) { return 1; }
+ virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* );
+ virtual int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT* ) { return 1; }
- virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; }
- virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return NULL; }
- virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg );
- virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ) { return 1; }
+ virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) { return 1; }
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return NULL; }
+ virtual int __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg );
+ virtual int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url ) { return 1; }
- virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode ) { return 1; }
+ virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode ) { return 1; }
virtual int __cdecl SetStatus( int iNewStatus );
- virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact ) { return NULL; }
- virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt ) { return 1; }
- virtual int __cdecl SendAwayMsg(HCONTACT hContact, HANDLE hProcess, const char* msg ) { return 1; }
+ virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact ) { return NULL; }
+ virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt ) { return 1; }
+ virtual int __cdecl SendAwayMsg(MCONTACT hContact, HANDLE hProcess, const char* msg ) { return 1; }
virtual int __cdecl SetAwayMsg( int iStatus, const PROTOCHAR* msg ) { return 1; }
- virtual int __cdecl UserIsTyping(HCONTACT hContact, int type );
+ virtual int __cdecl UserIsTyping(MCONTACT hContact, int type );
virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam ) { return 1; }
@@ -120,18 +120,18 @@ public:
void __cdecl SendCreateGroupWorker(void*);
// Contacts handling
- HCONTACT AddToContactList(const std::string& jid, BYTE type = 0, bool dont_check = false,
+ MCONTACT AddToContactList(const std::string& jid, BYTE type = 0, bool dont_check = false,
const char *new_name = NULL, bool isChatRoom = false, bool isHidden = false);
- bool IsMyContact(HCONTACT hContact, bool include_chat = false);
- HCONTACT ContactIDToHContact(const std::string&);
+ bool IsMyContact(MCONTACT hContact, bool include_chat = false);
+ MCONTACT ContactIDToHContact(const std::string&);
void SetAllContactStatuses(int status, bool reset_client = false);
- void UpdateStatusMsg(HCONTACT hContact);
- string GetContactDisplayName(HCONTACT hContact);
+ void UpdateStatusMsg(MCONTACT hContact);
+ string GetContactDisplayName(MCONTACT hContact);
string GetContactDisplayName(const string& jid);
void InitContactMenus();
void HandleReceiveGroups(const std::vector<string>& groups, bool isOwned);
- bool IsGroupChat(HCONTACT hC, bool checkIsAdmin = false)
+ bool IsGroupChat(MCONTACT hC, bool checkIsAdmin = false)
{
return getByte(hC, "SimpleChatRoom", 0) > (checkIsAdmin ? 1 : 0);
}
@@ -165,8 +165,8 @@ public:
string phoneNumber;
string jid;
string nick;
- std::map<string, HCONTACT> hContactByJid;
- map<HCONTACT, map<HCONTACT, bool>> isMemberByGroupContact;
+ std::map<string, MCONTACT> hContactByJid;
+ map<MCONTACT, map<MCONTACT, bool>> isMemberByGroupContact;
// WhatsApp Events
virtual void onMessageForMe(FMessage* paramFMessage, bool paramBoolean);
@@ -205,8 +205,8 @@ public:
virtual void onLeaveGroup(const std::string& paramString);
// Information providing
- void NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, TCHAR* url = NULL);
- void NotifyEvent(const string& title, const string& info, HCONTACT contact, DWORD flags, TCHAR* url = NULL);
+ void NotifyEvent(TCHAR* title, TCHAR* info, MCONTACT contact, DWORD flags, TCHAR* url = NULL);
+ void NotifyEvent(const string& title, const string& info, MCONTACT contact, DWORD flags, TCHAR* url = NULL);
};
#endif \ No newline at end of file
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp
index f76129f12d..ed1ef25743 100644
--- a/protocols/WhatsApp/src/theme.cpp
+++ b/protocols/WhatsApp/src/theme.cpp
@@ -40,7 +40,7 @@ char *GetIconDescription(const char* name)
HGENMENU g_hContactMenuItems[CMITEMS_COUNT];
// Helper functions
-static WhatsAppProto* GetInstanceByHContact(HCONTACT hContact)
+static WhatsAppProto* GetInstanceByHContact(MCONTACT hContact)
{
char *proto = GetContactProto(hContact);
if( !proto )
@@ -56,14 +56,14 @@ static WhatsAppProto* GetInstanceByHContact(HCONTACT hContact)
template<INT_PTR (__cdecl WhatsAppProto::*Fcn)(WPARAM,LPARAM)>
INT_PTR GlobalService(WPARAM wParam,LPARAM lParam)
{
- WhatsAppProto *proto = GetInstanceByHContact(HCONTACT(wParam));
+ WhatsAppProto *proto = GetInstanceByHContact(MCONTACT(wParam));
return proto ? (proto->*Fcn)(wParam,lParam) : 0;
}
template<INT_PTR (__cdecl WhatsAppProto::*Fcn)(WPARAM,LPARAM,LPARAM)>
INT_PTR GlobalServiceParam(WPARAM wParam,LPARAM lParam, LPARAM lParam2)
{
- WhatsAppProto *proto = GetInstanceByHContact(HCONTACT(wParam));
+ WhatsAppProto *proto = GetInstanceByHContact(MCONTACT(wParam));
return proto ? (proto->*Fcn)(wParam,lParam,lParam2) : 0;
}
@@ -72,7 +72,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam)
for (size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
Menu_ShowItem(g_hContactMenuItems[i], false);
- WhatsAppProto *proto = GetInstanceByHContact(HCONTACT(wParam));
+ WhatsAppProto *proto = GetInstanceByHContact(MCONTACT(wParam));
return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0;
}
@@ -104,7 +104,7 @@ void WhatsAppProto::InitContactMenus()
int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
- HCONTACT hContact = HCONTACT(wParam);
+ MCONTACT hContact = MCONTACT(wParam);
if (hContact)
debugLogA(this->GetContactDisplayName(hContact).c_str());
else
@@ -144,10 +144,10 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
svcName += "/AddContactToGroup_";
DBVARIANT dbv;
- for (map<HCONTACT, map<HCONTACT, bool>>::iterator it = this->isMemberByGroupContact.begin();
+ for (map<MCONTACT, map<MCONTACT, bool>>::iterator it = this->isMemberByGroupContact.begin();
it != this->isMemberByGroupContact.end(); ++it)
{
- map<HCONTACT, bool>::iterator memberIt = it->second.find(hContact);
+ map<MCONTACT, bool>::iterator memberIt = it->second.find(hContact);
// Only, if current contact is not already member of this group
if ((memberIt == it->second.end() || memberIt->second == false) && !getString(it->first, "ID", &dbv))
{
@@ -184,7 +184,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
bool bShow = false;
if (isOnline() && getByte(hContact, "IsGroupMember", 0) == 1)
{
- map<HCONTACT, map<HCONTACT, bool>>::iterator groupsIt = this->isMemberByGroupContact.find(hContact);
+ map<MCONTACT, map<MCONTACT, bool>>::iterator groupsIt = this->isMemberByGroupContact.find(hContact);
if (groupsIt == this->isMemberByGroupContact.end())
{
debugLogA("Group exists only on contact list");
@@ -199,7 +199,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
svcName += "/RemoveContactFromGroup_";
DBVARIANT dbv;
- for (map<HCONTACT, bool>::iterator it = groupsIt->second.begin(); it != groupsIt->second.end(); ++it)
+ for (map<MCONTACT, bool>::iterator it = groupsIt->second.begin(); it != groupsIt->second.end(); ++it)
{
if (!getString(it->first, "ID", &dbv))
{