summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-01 13:32:34 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-01 13:32:34 +0000
commit0daeae053e576727cf7132e947efcbab17b4962a (patch)
tree059d6b4a56dc7de9a438d248750e94beaa7fd08f
parent78ac37cc16584eecb54258bf68fe2eee4385b2a2 (diff)
Facebook: Some other changes
git-svn-id: http://svn.miranda-ng.org/main/trunk@11198 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/FacebookRM/res/facebook.rc52
-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
5 files changed, 49 insertions, 54 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc
index a7eb8de43e..7ca22fce7c 100644
--- a/protocols/FacebookRM/res/facebook.rc
+++ b/protocols/FacebookRM/res/facebook.rc
@@ -113,8 +113,8 @@ BEGIN
EDITTEXT IDC_PW,84,33,123,13,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Create a new Facebook account",IDC_NEWACCOUNTLINK,
"Hyperlink",WS_TABSTOP,84,52,189,10
- GROUPBOX "Network", IDC_STATIC, 7, 72, 291, 42
- CONTROL "Force secure (HTTPS) connection",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,85,281,10
+ GROUPBOX "Network",IDC_STATIC,7,72,291,42
+ CONTROL "Force secure (HTTPS) connection",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,85,281,10
CONTROL "Use secure connection also for channel requests",IDC_SECURE_CHANNEL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,31,99,262,10
GROUPBOX "Contacts",IDC_STATIC,7,120,291,60
@@ -125,7 +125,7 @@ BEGIN
CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,162,271,10
END
-IDD_OPTIONS_EVENTS DIALOGEX 0, 0, 305, 185
+IDD_OPTIONS_EVENTS DIALOGEX 0, 0, 305, 208
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -139,11 +139,13 @@ BEGIN
CONTROL "Don't show advertising posts",IDC_FILTER_ADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,67,138,8
CONTROL "Other events",IDC_OTHER_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,79,272,8
CONTROL "Client notifications",IDC_CLIENT_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,272,8
+ RTEXT "Use this server for opening links:",IDC_STATIC,13,123,139,8
+ COMBOBOX IDC_URL_SERVER,156,120,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Use balloon notifications in system tray instead of popups",IDC_SYSTRAY_NOTIFY,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,121,272,8
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,147,272,8
CONTROL "Use logging notifications into special chatroom",IDC_NOTIFICATIONS_CHATROOM,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,138,272,8
- PUSHBUTTON "Preview",IDC_PREVIEW,116,156,68,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,164,272,8
+ PUSHBUTTON "Preview",IDC_PREVIEW,116,182,68,14
END
IDD_OPTIONS_STATUSES DIALOGEX 0, 0, 308, 226
@@ -151,7 +153,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "Statuses",IDC_STATIC,7,7,294,91
+ GROUPBOX "Statuses",IDC_STATIC,7,7,294,73
CONTROL "Post Miranda statuses to Wall",IDC_SET_STATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,13,21,281,10
CONTROL "Turn off chat on Facebook when going to offline in Miranda",IDC_DISCONNECT_CHAT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,34,281,10
@@ -159,8 +161,6 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,47,281,10
CONTROL "Allow posting statuses to my pages (may slow down login)",IDC_LOAD_PAGES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,61,281,10
- RTEXT "Use this server for opening links:",IDC_STATIC,13,77,139,8
- COMBOBOX IDC_URL_SERVER,156,74,138,59,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_CAPTCHAFORM DIALOGEX 0, 0, 258, 224
@@ -185,25 +185,25 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Messages",IDC_STATIC,7,7,294,70
- CONTROL "Receive messages from ""inbox"" folder only",IDC_INBOX_ONLY,
+ CONTROL "Receive messages from ""inbox"" folder only",IDC_INBOX_ONLY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,281,10
- CONTROL "Use local time for received messages", IDC_USE_LOCAL_TIME,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 33, 281, 10
+ CONTROL "Use local time for received messages",IDC_USE_LOCAL_TIME,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,33,281,10
CONTROL "Keep messages as unread on server (don't send ""seen"" info)",IDC_KEEP_UNREAD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,47,281,10
- CONTROL "Show stickers as custom smileys (EXPERIMENTAL)", IDC_CUSTOM_SMILEYS,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 61, 281, 10
- GROUPBOX "Multi user chats", IDC_STATIC, 7, 83, 294, 43
- CONTROL "Enable multi user chats support", IDC_ENABLE_CHATS,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 96, 281, 10
- CONTROL "Do not open chat windows on creation", IDC_HIDE_CHATS,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 110, 281, 10
- GROUPBOX "History synchronization", IDC_STATIC, 7, 134, 294, 59
- CONTROL "Load last messages (24 hours old) on login (EXPERIMENTAL)", IDC_LOGIN_SYNC,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 148, 281, 10
- CONTROL "Load last messages on opening message window (EXPERIMENTAL)", IDC_MESSAGES_ON_OPEN,
- "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 13, 162, 281, 10
- RTEXT "Number of messages to load:", IDC_STATIC, 13, 176, 231, 8
+ CONTROL "Show stickers as custom smileys (EXPERIMENTAL)",IDC_CUSTOM_SMILEYS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,61,281,10
+ GROUPBOX "Multi user chats",IDC_STATIC,7,83,294,43
+ CONTROL "Enable multi user chats support",IDC_ENABLE_CHATS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,96,281,10
+ CONTROL "Do not open chat windows on creation",IDC_HIDE_CHATS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,110,281,10
+ GROUPBOX "History synchronization",IDC_STATIC,7,134,294,59
+ CONTROL "Load last messages (24 hours old) on login (EXPERIMENTAL)",IDC_LOGIN_SYNC,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,148,281,10
+ CONTROL "Load last messages on opening message window (EXPERIMENTAL)",IDC_MESSAGES_ON_OPEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,162,281,10
+ RTEXT "Number of messages to load:",IDC_STATIC,13,176,231,8
EDITTEXT IDC_MESSAGES_COUNT,249,173,34,14,ES_AUTOHSCROLL
CONTROL "",IDC_MESSAGES_COUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,283,173,11,14
END
@@ -267,7 +267,7 @@ BEGIN
VERTGUIDE, 150
VERTGUIDE, 288
TOPMARGIN, 7
- BOTTOMMARGIN, 177
+ BOTTOMMARGIN, 200
END
IDD_OPTIONS_STATUSES, DIALOG
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;