summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp36
-rw-r--r--protocols/FacebookRM/src/json.cpp6
-rw-r--r--protocols/FacebookRM/src/process.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp5
4 files changed, 23 insertions, 28 deletions
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index f546a54cf4..81103ed166 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -450,10 +450,6 @@ INT_PTR CALLBACK FBOptionsStatusesProc(HWND hwnd, UINT message, WPARAM wparam, L
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
- for(size_t i=0; i<SIZEOF(server_types); i++)
- SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(server_types[i].name)));
- SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0);
-
LoadDBCheckState(proto, hwnd, IDC_DISCONNECT_CHAT, FACEBOOK_KEY_DISCONNECT_CHAT, DEFAULT_DISCONNECT_CHAT);
LoadDBCheckState(proto, hwnd, IDC_SET_STATUS, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
LoadDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES);
@@ -463,23 +459,17 @@ INT_PTR CALLBACK FBOptionsStatusesProc(HWND hwnd, UINT message, WPARAM wparam, L
}
case WM_COMMAND: {
- switch (LOWORD(wparam)) {
- case IDC_URL_SERVER:
- if(HIWORD(wparam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
- break;
- default:
+ //switch (LOWORD(wparam)) {
+ //default:
SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
break;
- }
- break;
+ //}
+ //break;
}
case WM_NOTIFY:
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
- proto->setByte(FACEBOOK_KEY_SERVER_TYPE, SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_GETCURSEL, 0, 0));
-
StoreDBCheckState(proto, hwnd, IDC_DISCONNECT_CHAT, FACEBOOK_KEY_DISCONNECT_CHAT);
StoreDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES);
StoreDBCheckState(proto, hwnd, IDC_LOAD_PAGES, FACEBOOK_KEY_LOAD_PAGES);
@@ -517,12 +507,14 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
- for(size_t i=0; i<SIZEOF(feed_types); i++)
- {
- SendDlgItemMessageA(hwnd,IDC_FEED_TYPE,CB_INSERTSTRING,i,
- reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
- }
+ for (size_t i = 0; i<SIZEOF(feed_types); i++)
+ SendDlgItemMessageA(hwnd, IDC_FEED_TYPE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_FEED_TYPE, 0), 0);
+
+ for (size_t i = 0; i<SIZEOF(server_types); i++)
+ SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(server_types[i].name)));
+ SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0);
+
LoadDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_CHATROOM, FACEBOOK_KEY_NOTIFICATIONS_CHATROOM, DEFAULT_NOTIFICATIONS_CHATROOM);
@@ -544,8 +536,9 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA
proto->NotifyEvent(proto->m_tszUserName, TranslateT("Sample notification"), NULL, FACEBOOK_EVENT_NOTIFICATION);
break;
case IDC_FEED_TYPE:
- if(HIWORD(wparam) == CBN_SELCHANGE)
- SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
+ case IDC_URL_SERVER:
+ if (HIWORD(wparam) == CBN_SELCHANGE)
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
default:
SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
@@ -557,6 +550,7 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
proto->setByte(FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
+ proto->setByte(FACEBOOK_KEY_SERVER_TYPE, SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_GETCURSEL, 0, 0));
StoreDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_CHATROOM, FACEBOOK_KEY_NOTIFICATIONS_CHATROOM);
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 445d1e767d..4c24b138b8 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -473,12 +473,14 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa
participant = participants.find(reader_id);
if (participant != participants.end()) {
- MCONTACT hChatContact = proto->ChatIDToHContact(tid);
-
if (!chatroom->message_readers.empty())
chatroom->message_readers += ", ";
chatroom->message_readers += participant->second;
+ MCONTACT hChatContact = proto->ChatIDToHContact(tid);
+ if (!hChatContact)
+ continue;
+
ptrT readers(mir_utf8decodeT(chatroom->message_readers.c_str()));
StatusTextData st = { 0 };
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 406e8dfaf5..b4e182842e 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -568,7 +568,7 @@ void FacebookProto::SyncThreads(void*)
std::string timestamp = "0";
if (ptrtimestamp != NULL)
- timestamp = std::string(ptrtimestamp); // FIXME: is std::string(..) needed?
+ timestamp = ptrtimestamp;
unsigned __int64 time = _atoi64(timestamp.c_str());
@@ -752,7 +752,7 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message*> messages, boo
UpdateChat(tthread_id.c_str(), messages[i]->user_id.c_str(), messages[i]->sender_name.c_str(), messages[i]->message_text.c_str(), timestamp);
// Automatically mark message as read because chatroom doesn't support onRead event (yet)
- // ForkThread(&FacebookProto::ReadMessageWorker, (void*)hChatContact); // FIXME: temporary disabled
+ ForkThread(&FacebookProto::ReadMessageWorker, (void*)hChatContact);
} else {
// Single-user message
debugLogA(" Got message: %s", messages[i]->message_text.c_str());
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 15c7a220fb..b10a5821b5 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -563,12 +563,11 @@ int FacebookProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
MessageRead(event->hContact);
} else if (event->uType == MSG_WINDOW_EVT_OPEN) {
// Check if we have enabled loading messages on open window
- if (!getBool(FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN))
+ if (!getBool(FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN) || isChatRoom(event->hContact))
return 0;
// Load last messages for this contact
- if (!isChatRoom(event->hContact))
- ForkThread(&FacebookProto::LoadLastMessages, new MCONTACT(event->hContact));
+ ForkThread(&FacebookProto::LoadLastMessages, new MCONTACT(event->hContact));
}
return 0;