summaryrefslogtreecommitdiff
path: root/FacebookRM/contacts.cpp
diff options
context:
space:
mode:
authorwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2012-03-15 16:43:42 +0000
committerwatcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2012-03-15 16:43:42 +0000
commitde0c391964f20214bedcffa954c162360675d3b1 (patch)
tree09e0b8222a546665115ea358de5de3ad210984fd /FacebookRM/contacts.cpp
parent9ae77d567708f16deb9e9cb1c2761c332a618db8 (diff)
FacebookRM: version bump
# For running plugin is required Miranda 0.9.43 or newer # Plugin is compiled with VS2005 (Fb x86) and a VS2010 (Fb x64) + Added 2 types of newsfeeds: Photos and Links * Reworked options ! Fixed setting to notify different type of newsfeeds ! Fixed and improved parsing newsfeeds ! Fixed getting groupchat messages which contains % ! Fixed not working login ! Improved deleting of contacts + Support for Miranda's EV_PROTO_ONCONTACTDELETED events + Added missing GUID for x64 version and updated user-agent ! Some other minor fixes or improvements ! Fixed item 'Visit Profile' when protocol menus are moved to Main menu * Updated language pack file (for translators) - Disabled option for closing message windows on website (temporary doesnt work) git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@279 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'FacebookRM/contacts.cpp')
-rw-r--r--FacebookRM/contacts.cpp71
1 files changed, 34 insertions, 37 deletions
diff --git a/FacebookRM/contacts.cpp b/FacebookRM/contacts.cpp
index 20853c2..0b50411 100644
--- a/FacebookRM/contacts.cpp
+++ b/FacebookRM/contacts.cpp
@@ -146,6 +146,8 @@ void FacebookProto::DeleteContactFromServer(void *data)
query += "&__user=";
query += facy.self_.user_id;
+ delete data;
+
// Get unread inbox threads
http::response resp = facy.flap( FACEBOOK_REQUEST_DELETE_FRIEND, &query );
@@ -156,9 +158,8 @@ void FacebookProto::DeleteContactFromServer(void *data)
facy.handle_error( "DeleteContactFromServer" );
}
- NotifyEvent(TranslateT("Deleting contact"), TranslateT("Contact was sucessfully removed from server."), NULL, FACEBOOK_EVENT_OTHER, NULL);
-
- delete data;
+ // TODO: better notify - check result code
+ NotifyEvent(TranslateT("Deleting contact"), TranslateT("Contact was sucessfully removed from server."), NULL, FACEBOOK_EVENT_OTHER, NULL);
}
void FacebookProto::AddContactToServer(void *data)
@@ -179,6 +180,8 @@ void FacebookProto::AddContactToServer(void *data)
query += "&__user=";
query += facy.self_.user_id;
+ delete data;
+
// Get unread inbox threads
http::response resp = facy.flap( FACEBOOK_REQUEST_ADD_FRIEND, &query );
@@ -188,10 +191,8 @@ void FacebookProto::AddContactToServer(void *data)
if (resp.code != HTTP_CODE_OK || resp.data.find("\"success\":true") == std::string::npos) {
facy.handle_error( "AddContactToServer" );
}
-// RM TODO: better notify...
+// RM TODO: better notify... - check result code
NotifyEvent(TranslateT("Adding contact"), TranslateT("Request for friendship was sent successfully."), NULL, FACEBOOK_EVENT_OTHER, NULL);
-
- delete data;
}
@@ -204,41 +205,37 @@ int FacebookProto::OnContactDeleted(WPARAM wparam,LPARAM)
{
HANDLE hContact = (HANDLE)wparam;
- if (IsMyContact(hContact))
- {
-// if (!DBGetContactSettingByte(hContact,m_szModuleName,FACEBOOK_KEY_DELETE_NEXT,0)) {
- if (MessageBox( 0, TranslateT("Do you want to delete this contact also from server list?"), m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
- DBVARIANT dbv;
- if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) )
- {
- if (!isOffline()) {
- std::string* id = new std::string(dbv.pszVal);
- ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
- DBFreeVariant(&dbv);
- } else {
-/* facebook_user fbu;
- fbu.user_id = dbv.pszVal;
- hContact = AddToContactList(&fbu);
-
- DBWriteContactSettingByte(hContact,m_szModuleName,FACEBOOK_KEY_DELETE_NEXT,1);
- facy.client_notify(TranslateT("Contact will be deleted at next login."));*/
- NotifyEvent(TranslateT("Deleting contact"), TranslateT("Contact wasn't deleted, because you are not connected."), NULL, FACEBOOK_EVENT_OTHER, NULL);
- }
- }
- }
-// }
-
- ScopedLock s(facy.buddies_lock_);
-
- for (List::Item< facebook_user >* i = facy.buddies.begin( ); i != NULL; i = i->next )
+ DBVARIANT dbv;
+ TCHAR text[512];
+ if ( !DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv) ) {
+ mir_sntprintf(text,SIZEOF(text),TranslateT("Do you want to delete contact '%s' from server list?"),dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ } else if( !DBGetContactSettingTString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) {
+ mir_sntprintf(text,SIZEOF(text),TranslateT("Do you want to delete contact '%s' from server list?"),dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+
+ if (MessageBox( 0, text, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
+
+ if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) )
{
- if (hContact == i->data->handle)
- {
- facy.buddies.erase(i->key);
- break;
+ if (!isOffline()) { // TODO: is this needed?
+ std::string* id = new std::string(dbv.pszVal);
+ ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
+ DBFreeVariant(&dbv);
}
}
}
+ //ScopedLock s(facy.buddies_lock_);
+ for (List::Item< facebook_user >* i = facy.buddies.begin( ); i != NULL; i = i->next )
+ {
+ if (hContact == i->data->handle)
+ {
+ facy.buddies.erase(i->key);
+ break;
+ }
+ }
+
return 0;
}