summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
commitddba4ede6b451d0cfcd0d32b5180fbd0689966bf (patch)
tree5d74f37a7013d13b92c182628d6b68a58e148ae4 /protocols/FacebookRM
parentc39340bf493a1745a41317bbf937fc7eb6cbb26a (diff)
- HANDLE hContact => HCONTACT
- GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/avatars.cpp2
-rw-r--r--protocols/FacebookRM/src/chat.cpp8
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/contacts.cpp32
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp19
-rw-r--r--protocols/FacebookRM/src/entities.h10
-rw-r--r--protocols/FacebookRM/src/events.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp6
-rw-r--r--protocols/FacebookRM/src/messages.cpp12
-rw-r--r--protocols/FacebookRM/src/process.cpp14
-rw-r--r--protocols/FacebookRM/src/proto.cpp30
-rw-r--r--protocols/FacebookRM/src/proto.h64
-rw-r--r--protocols/FacebookRM/src/stubs.cpp26
-rw-r--r--protocols/FacebookRM/src/theme.cpp8
14 files changed, 118 insertions, 117 deletions
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index 196497a291..8e3006a12a 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -48,7 +48,7 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *
return false;
}
-void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url)
+void FacebookProto::CheckAvatarChange(HCONTACT hContact, std::string image_url)
{
// Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts)
if (image_url.empty())
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 9b4dd11a58..6a4884090c 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -84,7 +84,7 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam)
case GC_USER_PRIVMESS:
{
char* sn = mir_t2a(hook->ptszUID);
- HANDLE hContact = ContactIDToHContact(sn);
+ HCONTACT hContact = ContactIDToHContact(sn);
mir_free(sn);
CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0);
@@ -112,7 +112,7 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam)
case GC_USER_NICKLISTMENU:
{
char *sn = mir_t2a(hook->ptszUID);
- HANDLE hContact = ContactIDToHContact(sn);
+ HCONTACT hContact = ContactIDToHContact(sn);
mir_free(sn);
switch (hook->dwData)
@@ -194,7 +194,7 @@ void FacebookProto::RemoveChatContact(const TCHAR *tchat_id, const char *id)
char *FacebookProto::GetChatUsers(const TCHAR *chat_id)
{
GC_INFO gci = {0};
- gci.Flags = USERS;
+ gci.Flags = GCF_USERS;
gci.pszModule = m_szModuleName;
gci.pszID = chat_id;
CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
@@ -248,7 +248,7 @@ void FacebookProto::AddChat(const TCHAR *tid, const TCHAR *tname)
INT_PTR FacebookProto::OnJoinChat(WPARAM wParam,LPARAM suppress)
{
- HANDLE hContact = (HANDLE)wParam;
+ HCONTACT hContact = (HCONTACT)wParam;
// TODO: load info from server + old history,...
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index fb2f712265..92333f3d1f 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -1252,7 +1252,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me
case 1356003: // Contact is offline
{
- HANDLE hContact = parent->ContactIDToHContact(message_recipient);
+ HCONTACT hContact = parent->ContactIDToHContact(message_recipient);
if (hContact != NULL)
parent->setWord(hContact, "Status", ID_STATUS_OFFLINE);
return false;
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index f225c5b8c7..fde9b8f678 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
-void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu)
+void FacebookProto::SaveName(HCONTACT hContact, const facebook_user *fbu)
{
if (fbu->real_name.empty()) {
delSetting(hContact, FACEBOOK_KEY_NICK);
@@ -55,7 +55,7 @@ void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu)
}
}
-bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat)
+bool FacebookProto::IsMyContact(HCONTACT hContact, bool include_chat)
{
const char *proto = GetContactProto(hContact);
if (proto && !strcmp(m_szModuleName, proto)) {
@@ -66,9 +66,9 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat)
return false;
}
-HANDLE FacebookProto::ChatIDToHContact(std::tstring chat_id)
+HCONTACT FacebookProto::ChatIDToHContact(std::tstring chat_id)
{
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (!IsMyContact(hContact, true))
continue;
@@ -80,9 +80,9 @@ HANDLE FacebookProto::ChatIDToHContact(std::tstring chat_id)
return 0;
}
-HANDLE FacebookProto::ContactIDToHContact(std::string user_id)
+HCONTACT FacebookProto::ContactIDToHContact(std::string user_id)
{
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (!IsMyContact(hContact))
continue;
@@ -98,7 +98,7 @@ std::string FacebookProto::ThreadIDToContactID(std::string thread_id)
{
std::string user_id;
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (!IsMyContact(hContact))
continue;
@@ -138,9 +138,9 @@ std::string FacebookProto::ThreadIDToContactID(std::string thread_id)
return user_id;
}
-HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, bool dont_check)
+HCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, bool dont_check)
{
- HANDLE hContact;
+ HCONTACT hContact;
if (!dont_check) {
// First, check if this contact exists
@@ -150,7 +150,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo
}
// If not, make a new contact!
- hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
if(hContact)
{
if(CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0)
@@ -193,7 +193,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo
void FacebookProto::SetAllContactStatuses(int status)
{
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (isChatRoom(hContact))
continue;
@@ -228,7 +228,7 @@ void FacebookProto::DeleteContactFromServer(void *data)
if (fbu != NULL)
fbu->deleted = true;
- HANDLE hContact = ContactIDToHContact(id);
+ HCONTACT hContact = ContactIDToHContact(id);
// If contact wasn't deleted from database
if (hContact != NULL) {
@@ -265,7 +265,7 @@ void FacebookProto::AddContactToServer(void *data)
http::response resp = facy.flap(REQUEST_REQUEST_FRIEND, &query);
if (resp.data.find("\"success\":true", 0) != std::string::npos) {
- HANDLE hContact = ContactIDToHContact(id);
+ HCONTACT hContact = ContactIDToHContact(id);
// If contact wasn't deleted from database
if (hContact != NULL)
@@ -287,7 +287,7 @@ void FacebookProto::ApproveContactToServer(void *data)
if (data == NULL)
return;
- HANDLE hContact = (*(HANDLE*)data);
+ HCONTACT hContact = *(HCONTACT*)data;
delete data;
std::string post_data = "fb_dtsg=" + facy.dtsg_;
@@ -310,7 +310,7 @@ void FacebookProto::CancelFriendsRequest(void *data)
if (data == NULL)
return;
- HANDLE hContact = (*(HANDLE*)data);
+ HCONTACT hContact = *(HCONTACT*)data;
delete data;
std::string query = "phstamp=0&confirmed=1";
@@ -370,7 +370,7 @@ void FacebookProto::SendPokeWorker(void *p)
}
-HANDLE FacebookProto::GetAwayMsg(HANDLE hContact)
+HANDLE FacebookProto::GetAwayMsg(HCONTACT hContact)
{
return 0; // Status messages are disabled
}
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 49bb562c39..e35c52f3b9 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -120,20 +120,21 @@ void RefreshPrivacy(HWND hwnd, post_status_data *data)
SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_PRIVACY_TYPE, 0), 0);
}
-void ClistPrepare(FacebookProto *proto, HANDLE hItem, HWND hwndList)
+void ClistPrepare(FacebookProto *proto, HCONTACT hItem, HWND hwndList)
{
if (hItem == NULL)
- hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
+ hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
while (hItem)
{
- HANDLE hItemN = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
+ HCONTACT hItemN = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
if (IsHContactGroup(hItem)) {
- HANDLE hItemT = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ HCONTACT hItemT = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItemT)
ClistPrepare(proto, hItemT, hwndList);
- } else if (IsHContactContact(hItem)) {
+ }
+ else if (IsHContactContact(hItem)) {
if (!proto->IsMyContact(hItem) || ptrA(proto->getStringA(hItem, FACEBOOK_KEY_ID)) == NULL)
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
@@ -142,14 +143,14 @@ void ClistPrepare(FacebookProto *proto, HANDLE hItem, HWND hwndList)
}
}
-void GetSelectedContacts(FacebookProto *proto, HANDLE hItem, HWND hwndList, std::vector<facebook_user*> *contacts)
+void GetSelectedContacts(FacebookProto *proto, HCONTACT hItem, HWND hwndList, std::vector<facebook_user*> *contacts)
{
if (hItem == NULL)
- hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
+ hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
while (hItem) {
if (IsHContactGroup(hItem)) {
- HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hItemT)
GetSelectedContacts(proto, hItemT, hwndList, contacts);
} else {
@@ -160,7 +161,7 @@ void GetSelectedContacts(FacebookProto *proto, HANDLE hItem, HWND hwndList, std:
contacts->push_back(fu);
}
}
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
+ hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
}
}
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h
index a924324019..6909b6d611 100644
--- a/protocols/FacebookRM/src/entities.h
+++ b/protocols/FacebookRM/src/entities.h
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
struct facebook_user
{
- HANDLE handle;
+ HCONTACT handle;
std::string user_id;
std::string real_name;
@@ -164,16 +164,16 @@ struct send_chat
struct send_direct
{
- send_direct(HANDLE hContact,const std::string &msg, HANDLE msgid) : hContact(hContact), msg(msg), msgid(msgid) {}
- HANDLE hContact;
+ send_direct(HCONTACT hContact,const std::string &msg, HANDLE msgid) : hContact(hContact), msg(msg), msgid(msgid) {}
+ HCONTACT hContact;
std::string msg;
HANDLE msgid;
};
struct send_typing
{
- send_typing(HANDLE hContact,const int status) : hContact(hContact), status(status) {}
- HANDLE hContact;
+ send_typing(HCONTACT hContact,const int status) : hContact(hContact), status(status) {}
+ HCONTACT hContact;
int status;
};
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index 676522cc87..81c54f3fd8 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
-void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url, std::string *notification_id)
+void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, std::string *url, std::string *notification_id)
{
char name[256];
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 06118a9381..28e102b46e 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -438,7 +438,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa
}
}
} else { // classic contact
- HANDLE hContact = proto->ContactIDToHContact(json_as_pstring(reader));
+ HCONTACT hContact = proto->ContactIDToHContact(json_as_pstring(reader));
if (hContact) {
TCHAR ttime[64], tstr[100];
_tcsftime(ttime, SIZEOF(ttime), _T("%X"), utils::conversion::fbtime_to_timeinfo(json_as_float(time)));
@@ -519,7 +519,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa
}
}
- HANDLE hChatContact = NULL;
+ HCONTACT hChatContact = NULL;
// RM TODO: better use check if chatroom exists/is in db/is online... no?
/// e.g. HANDLE hChatContact = proto->ChatIDToHContact(thread_id); ?
@@ -627,7 +627,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa
facebook_user fbu;
fbu.user_id = json_as_pstring(from);
- HANDLE hContact = proto->AddToContactList(&fbu, CONTACT_FRIEND);
+ HCONTACT hContact = proto->AddToContactList(&fbu, CONTACT_FRIEND);
if (proto->isOnline() && proto->getWord(hContact, "Status", 0) == ID_STATUS_OFFLINE)
proto->setWord(hContact, "Status", ID_STATUS_ONLINE);
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index 667692a4c9..051cb9cd39 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
-int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre)
+int FacebookProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre)
{
ForkThread(&FacebookProto::ReadMessageWorker, hContact);
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -76,7 +76,7 @@ void FacebookProto::SendChatMsgWorker(void *p)
send_chat *data = static_cast<send_chat*>(p);
std::string err_message = "";
- HANDLE hContact = ChatIDToHContact(std::tstring(_A2T(data->chat_id.c_str())));
+ HCONTACT hContact = ChatIDToHContact(std::tstring(_A2T(data->chat_id.c_str())));
if (hContact) {
std::string tid;
DBVARIANT dbv;
@@ -107,7 +107,7 @@ void FacebookProto::SendChatMsgWorker(void *p)
delete data;
}
-int FacebookProto::SendMsg(HANDLE hContact, int flags, const char *msg)
+int FacebookProto::SendMsg(HCONTACT hContact, int flags, const char *msg)
{
// TODO: msg comes as Unicode (retyped wchar_t*), why should we convert it as ANSI to UTF-8? o_O
if (flags & PREF_UNICODE)
@@ -118,7 +118,7 @@ int FacebookProto::SendMsg(HANDLE hContact, int flags, const char *msg)
return facy.msgid_;
}
-int FacebookProto::UserIsTyping(HANDLE hContact,int type)
+int FacebookProto::UserIsTyping(HCONTACT hContact,int type)
{
if (hContact && isOnline())
ForkThread(&FacebookProto::SendTypingWorker, new send_typing(hContact, type));
@@ -168,7 +168,7 @@ void FacebookProto::ReadMessageWorker(void *p)
if (p == NULL)
return;
- HANDLE hContact = static_cast<HANDLE>(p);
+ HCONTACT hContact = static_cast<HCONTACT>(p);
if (getBool(FACEBOOK_KEY_KEEP_UNREAD, 0) || getBool(hContact, FACEBOOK_KEY_KEEP_UNREAD, 0))
return;
@@ -186,7 +186,7 @@ void FacebookProto::ReadMessageWorker(void *p)
facy.flap(REQUEST_MARK_READ, &data);
}
-void FacebookProto::ParseSmileys(std::string message, HANDLE hContact)
+void FacebookProto::ParseSmileys(std::string message, HCONTACT hContact)
{
if (!getByte(FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS))
return;
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 777ce172db..c06e9b562a 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -63,7 +63,7 @@ void FacebookProto::ProcessBuddyList(void* data)
if (!fbu->deleted)
{
- HANDLE hContact = fbu->handle;
+ HCONTACT hContact = fbu->handle;
if (!hContact)
hContact = AddToContactList(fbu, CONTACT_FRIEND);
@@ -154,7 +154,7 @@ void FacebookProto::ProcessFriendList(void* data)
// Check and update old contacts
- for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if ( isChatRoom(hContact))
continue;
@@ -243,7 +243,7 @@ void FacebookProto::ProcessFriendList(void* data)
facebook_user *fbu = iter->second;
if (!fbu->deleted)
- HANDLE hContact = AddToContactList(fbu, CONTACT_FRIEND/*, true*/); // This contact is surely new ...am I sure? ...I'm not, so "true" is commented now
+ HCONTACT hContact = AddToContactList(fbu, CONTACT_FRIEND/*, true*/); // This contact is surely new ...am I sure? ...I'm not, so "true" is commented now
delete fbu;
}
@@ -361,7 +361,7 @@ void FacebookProto::ProcessUnreadMessage(void *p)
for (std::map<std::string, facebook_chatroom*>::iterator it = chatrooms.begin(); it != chatrooms.end(); ) {
facebook_chatroom *room = it->second;
- HANDLE hChatContact = NULL;
+ HCONTACT hChatContact = NULL;
if (GetChatUsers(room->thread_id.c_str()) == NULL) {
AddChat(room->thread_id.c_str(), room->chat_name.c_str());
hChatContact = ChatIDToHContact(room->thread_id);
@@ -397,7 +397,7 @@ void FacebookProto::ProcessUnreadMessage(void *p)
fbu.real_name = messages[i]->sender_name;
// TODO: optimize this?
- HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE);
+ HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE);
setString(hContact, FACEBOOK_KEY_MESSAGE_ID, messages[i]->message_id.c_str());
// Save TID if not exists already
@@ -486,7 +486,7 @@ void FacebookProto::ProcessMessages(void* data)
fbu.user_id = messages[i]->user_id;
fbu.real_name = messages[i]->sender_name;
- HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE);
+ HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE);
setString(hContact, FACEBOOK_KEY_MESSAGE_ID, messages[i]->message_id.c_str());
// Save TID if not exists already
@@ -627,7 +627,7 @@ void FacebookProto::ProcessFriendRequests(void*)
if (fbu->user_id.length() && fbu->real_name.length())
{
- HANDLE hContact = AddToContactList(fbu, CONTACT_APPROVE);
+ HCONTACT hContact = AddToContactList(fbu, CONTACT_APPROVE);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_APPROVE);
bool seen = false;
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index bbe948120d..5e05071dec 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -104,7 +104,7 @@ FacebookProto::~FacebookProto()
//////////////////////////////////////////////////////////////////////////////
-DWORD_PTR FacebookProto::GetCaps(int type, HANDLE hContact)
+DWORD_PTR FacebookProto::GetCaps(int type, HCONTACT hContact)
{
switch(type)
{
@@ -261,7 +261,7 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
return NULL;
}
- HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE);
+ HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE);
if (hContact) {
if (flags & PALF_TEMPORARY) {
db_set_b(hContact, "Clist", "Hidden", 1);
@@ -276,7 +276,7 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
return hContact;
}
-int FacebookProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message)
+int FacebookProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message)
{
return RequestFriendship((WPARAM)hContact, NULL);
}
@@ -286,7 +286,7 @@ int FacebookProto::Authorize(HANDLE hDbEvent)
if (!hDbEvent || isOffline())
return 1;
- HANDLE hContact = HContactFromAuthEvent(hDbEvent);
+ HCONTACT hContact = HContactFromAuthEvent(hDbEvent);
if (hContact == INVALID_HANDLE_VALUE)
return 1;
@@ -298,7 +298,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
if (!hDbEvent || isOffline())
return 1;
- HANDLE hContact = HContactFromAuthEvent(hDbEvent);
+ HCONTACT hContact = HContactFromAuthEvent(hDbEvent);
if (hContact == INVALID_HANDLE_VALUE)
return 1;
@@ -450,7 +450,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam)
if (!isOnline())
return 1;
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
wall_data *wall = new wall_data();
wall->user_id = ptrA(getStringA(hContact, FACEBOOK_KEY_ID));
@@ -504,7 +504,7 @@ INT_PTR FacebookProto::RefreshBuddyList(WPARAM, LPARAM)
INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
std::string url = FACEBOOK_URL_PROFILE;
@@ -527,7 +527,7 @@ INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
INT_PTR FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
if (wParam == 0 || !IsMyContact(hContact))
return 1;
@@ -547,7 +547,7 @@ INT_PTR FacebookProto::Poke(WPARAM wParam,LPARAM lParam)
if (wParam == NULL || isOffline())
return 1;
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
if (id == NULL)
@@ -564,7 +564,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam)
bool deleting = (lParam == 1);
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
// Ignore groupchats and, if deleting, also not-friends
if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) != CONTACT_FRIEND))
@@ -601,7 +601,7 @@ INT_PTR FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam)
if (wParam == NULL || isOffline())
return 1;
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
if (id == NULL)
@@ -633,7 +633,7 @@ INT_PTR FacebookProto::OnCancelFriendshipRequest(WPARAM wParam,LPARAM lParam)
return 0;
}
-HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent)
+HCONTACT FacebookProto::HContactFromAuthEvent(HANDLE hEvent)
{
DWORD body[2];
DBEVENTINFO dbei = { sizeof(dbei) };
@@ -641,13 +641,13 @@ HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent)
dbei.pBlob = (PBYTE)&body;
if (db_event_get(hEvent, &dbei))
- return INVALID_HANDLE_VALUE;
+ return (HCONTACT)INVALID_HANDLE_VALUE;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
- return INVALID_HANDLE_VALUE;
+ return (HCONTACT)INVALID_HANDLE_VALUE;
if (strcmp(dbei.szModule, m_szModuleName))
- return INVALID_HANDLE_VALUE;
+ return (HCONTACT)INVALID_HANDLE_VALUE;
return DbGetAuthEventContact(&dbei);
}
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 3d056a92c4..9b5b550253 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -54,11 +54,11 @@ public:
__forceinline INT_PTR getStringUtf(const char *name, DBVARIANT *result) {
return db_get_utf(NULL, m_szModuleName, name, result); }
- __forceinline INT_PTR getStringUtf(HANDLE hContact, const char *name, DBVARIANT *result) {
+ __forceinline INT_PTR getStringUtf(HCONTACT hContact, const char *name, DBVARIANT *result) {
return db_get_utf(hContact, m_szModuleName, name, result); }
__forceinline void setStringUtf(const char *name, const char* value) { db_set_utf(NULL, m_szModuleName, name, value); }
- __forceinline void setStringUtf(HANDLE hContact, const char *name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); }
+ __forceinline void setStringUtf(HCONTACT hContact, const char *name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); }
//PROTO_INTERFACE
@@ -67,18 +67,18 @@ public:
virtual int __cdecl Authorize(HANDLE hDbEvent);
virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason);
- virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*);
- virtual int __cdecl AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage);
+ virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*);
+ virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage);
virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData);
- virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
- virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer);
- virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
+ virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
+ virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer);
+ virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename);
- virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL);
- virtual int __cdecl GetInfo(HANDLE hContact, int infoType);
+ virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL);
+ virtual int __cdecl GetInfo(HCONTACT hContact, int infoType);
virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id);
virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email);
@@ -86,24 +86,24 @@ public:
virtual HWND __cdecl SearchAdvanced(HWND owner);
virtual HWND __cdecl CreateExtendedSearchUI(HWND owner);
- virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*);
- virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*);
- virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*);
- virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*);
+ virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*);
+ virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*);
+ virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*);
+ virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*);
- virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList);
- virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
- virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg);
- virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url);
+ virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList);
+ virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
+ virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg);
+ virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url);
- virtual int __cdecl SetApparentMode(HANDLE hContact, int mode);
+ virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode);
virtual int __cdecl SetStatus(int iNewStatus);
- virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact);
- virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt);
+ virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact);
+ virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt);
virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg);
- virtual int __cdecl UserIsTyping(HANDLE hContact, int type);
+ virtual int __cdecl UserIsTyping(HCONTACT hContact, int type);
virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
@@ -185,13 +185,13 @@ public:
void __cdecl SendPokeWorker(void*);
// Contacts handling
- bool IsMyContact(HANDLE, bool include_chat = false);
- HANDLE ContactIDToHContact(std::string);
- HANDLE ChatIDToHContact(std::tstring);
+ bool IsMyContact(HCONTACT, bool include_chat = false);
+ HCONTACT ContactIDToHContact(std::string);
+ HCONTACT ChatIDToHContact(std::tstring);
std::string ThreadIDToContactID(std::string thread_id);
- HANDLE AddToContactList(facebook_user*, ContactType type, bool dont_check = false);
- void SetAllContactStatuses(int status);
- HANDLE HContactFromAuthEvent(HANDLE hEvent);
+ HCONTACT AddToContactList(facebook_user*, ContactType type, bool dont_check = false);
+ void SetAllContactStatuses(int status);
+ HCONTACT HContactFromAuthEvent(HANDLE hEvent);
// Chats handling
void AddChat(const TCHAR *id, const TCHAR *name);
@@ -209,11 +209,11 @@ public:
// Helpers
std::tstring GetAvatarFolder();
bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url);
- void CheckAvatarChange(HANDLE hContact, std::string image_url);
+ void CheckAvatarChange(HCONTACT hContact, std::string image_url);
void ToggleStatusMenuItems(BOOL bEnable);
- void ParseSmileys(std::string message, HANDLE hContact);
+ void ParseSmileys(std::string message, HCONTACT hContact);
void OpenUrl(std::string url);
- void SaveName(HANDLE hContact, const facebook_user *fbu);
+ void SaveName(HCONTACT hContact, const facebook_user *fbu);
// Handles, Locks
HGENMENU m_hMenuRoot, m_hMenuServicesRoot, m_hStatusMind;
@@ -227,10 +227,10 @@ public:
std::string last_status_msg_;
HANDLE hSmileysFolder_;
- std::vector<HANDLE> avatar_queue;
+ std::vector<HCONTACT> avatar_queue;
static void CALLBACK APC_callback(ULONG_PTR p);
// Information providing
- void NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL);
+ void NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL);
};
diff --git a/protocols/FacebookRM/src/stubs.cpp b/protocols/FacebookRM/src/stubs.cpp
index 1689b89f3f..34412fe8b3 100644
--- a/protocols/FacebookRM/src/stubs.cpp
+++ b/protocols/FacebookRM/src/stubs.cpp
@@ -27,7 +27,7 @@ HANDLE FacebookProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent)
return NULL;
}
-int FacebookProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *)
+int FacebookProto::AuthRecv(HCONTACT hContact,PROTORECVEVENT *)
{
return 1;
}
@@ -38,17 +38,17 @@ HANDLE FacebookProto::ChangeInfo(int type,void *info_data)
return NULL;
}
-HANDLE FacebookProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path)
+HANDLE FacebookProto::FileAllow(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *path)
{
return NULL;
}
-int FacebookProto::FileCancel(HANDLE hContact,HANDLE hTransfer)
+int FacebookProto::FileCancel(HCONTACT hContact,HANDLE hTransfer)
{
return 1;
}
-int FacebookProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason)
+int FacebookProto::FileDeny(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *reason)
{
return 1;
}
@@ -58,7 +58,7 @@ int FacebookProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **fil
return 1;
}
-int FacebookProto::GetInfo(HANDLE hContact, int infoType)
+int FacebookProto::GetInfo(HCONTACT hContact, int infoType)
{
// TODO: Most probably some ProtoAck should be here instead
return 1;
@@ -74,42 +74,42 @@ HWND FacebookProto::CreateExtendedSearchUI(HWND owner)
return NULL;
}
-int FacebookProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *)
+int FacebookProto::RecvContacts(HCONTACT hContact,PROTORECVEVENT *)
{
return 1;
}
-int FacebookProto::RecvFile(HANDLE hContact,PROTORECVFILET *)
+int FacebookProto::RecvFile(HCONTACT hContact,PROTORECVFILET *)
{
return 1;
}
-int FacebookProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *)
+int FacebookProto::RecvUrl(HCONTACT hContact,PROTORECVEVENT *)
{
return 1;
}
-int FacebookProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList)
+int FacebookProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList)
{
return 1;
}
-HANDLE FacebookProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files)
+HANDLE FacebookProto::SendFile(HCONTACT hContact,const PROTOCHAR *desc, PROTOCHAR **files)
{
return NULL;
}
-int FacebookProto::SendUrl(HANDLE hContact,int flags,const char *url)
+int FacebookProto::SendUrl(HCONTACT hContact,int flags,const char *url)
{
return 1;
}
-int FacebookProto::SetApparentMode(HANDLE hContact,int mode)
+int FacebookProto::SetApparentMode(HCONTACT hContact,int mode)
{
return 1;
}
-int FacebookProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt)
+int FacebookProto::RecvAwayMsg(HCONTACT hContact,int mode,PROTORECVEVENT *evt)
{
return 1;
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 6177f46b96..e0b7fd134e 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -53,7 +53,7 @@ HANDLE GetIconHandle(const char* name)
HGENMENU g_hContactMenuItems[CMITEMS_COUNT];
// Helper functions
-static FacebookProto * GetInstanceByHContact(HANDLE hContact)
+static FacebookProto * GetInstanceByHContact(HCONTACT hContact)
{
char *proto = GetContactProto(hContact);
if(!proto)
@@ -69,7 +69,7 @@ static FacebookProto * GetInstanceByHContact(HANDLE hContact)
template<INT_PTR (__cdecl FacebookProto::*Fcn)(WPARAM,LPARAM)>
INT_PTR GlobalService(WPARAM wParam,LPARAM lParam)
{
- FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HANDLE>(wParam));
+ FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HCONTACT>(wParam));
return proto ? (proto->*Fcn)(wParam,lParam) : 0;
}
@@ -78,7 +78,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam)
for (size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
Menu_ShowItem(g_hContactMenuItems[i], false);
- FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HANDLE>(wParam));
+ FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HCONTACT>(wParam));
return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0;
}
@@ -152,7 +152,7 @@ void UninitContactMenus()
int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
- HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
+ HCONTACT hContact = reinterpret_cast<HCONTACT>(wParam);
bool bIsChatroom = isChatRoom(hContact);
Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);