summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-29 13:19:54 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-29 13:19:54 +0000
commit173d82c142334fec7d45d3dd170bdaa81d11cc8e (patch)
treecb3dc94e03cac699e7803bcd217cdbfffbff7b91 /protocols/FacebookRM/src
parent18ddcdba70b8140905168cbf610906acb08e7037 (diff)
Facebook: Added option for loading messages on opening message window; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@9341 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r--protocols/FacebookRM/src/constants.h3
-rw-r--r--protocols/FacebookRM/src/db.h2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp13
-rw-r--r--protocols/FacebookRM/src/process.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/FacebookRM/src/resource.h10
-rw-r--r--protocols/FacebookRM/src/version.h4
7 files changed, 34 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h
index 29fa13751e..6d1ffac66d 100644
--- a/protocols/FacebookRM/src/constants.h
+++ b/protocols/FacebookRM/src/constants.h
@@ -55,6 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_MIND_LIMIT_TEXT "63206"
#define FACEBOOK_TIMEOUTS_LIMIT 3
#define FACEBOOK_GROUP_NAME_LIMIT 100
+#define FACEBOOK_MESSAGES_ON_OPEN_LIMIT 99
// Defaults
#define FACEBOOK_MINIMAL_POLL_RATE 10
@@ -76,6 +77,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEFAULT_KEEP_UNREAD 0
#define DEFAULT_INBOX_ONLY 0
#define DEFAULT_FILTER_ADS 0
+#define DEFAULT_MESSAGES_ON_OPEN 0
+#define DEFAULT_MESSAGES_ON_OPEN_COUNT 10
#define DEFAULT_EVENT_NOTIFICATIONS_ENABLE 1
#define DEFAULT_EVENT_FEEDS_ENABLE 1
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index be6f42c41e..bac57004c9 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -55,6 +55,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_KEY_KEEP_UNREAD "KeepUnread" // (byte) 1 = don't mark messages as read on server (works globally or per contact)
#define FACEBOOK_KEY_INBOX_ONLY "InboxOnly"
#define FACEBOOK_KEY_FILTER_ADS "FilterAds"
+#define FACEBOOK_KEY_MESSAGES_ON_OPEN "MessagesOnOpen"
+#define FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT "MessagesOnOpenCount"
#define FACEBOOK_KEY_POLL_RATE "PollRate" // [HIDDEN]
#define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index d9ed46a869..ffe1168e93 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -456,6 +456,14 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L
LoadDBCheckState(proto, hwnd, IDC_LOAD_PAGES, FACEBOOK_KEY_LOAD_PAGES, DEFAULT_LOAD_PAGES);
LoadDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY, DEFAULT_INBOX_ONLY);
LoadDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD, DEFAULT_KEEP_UNREAD);
+ LoadDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN);
+
+ int count = proto->getByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, 10);
+ count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT);
+ SetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, count, TRUE);
+
+ SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT, EM_LIMITTEXT, 2, 0);
+ SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT_SPIN, UDM_SETRANGE32, 1, 99);
EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
@@ -489,6 +497,11 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L
StoreDBCheckState(proto, hwnd, IDC_LOAD_PAGES, FACEBOOK_KEY_LOAD_PAGES);
StoreDBCheckState(proto, hwnd, IDC_INBOX_ONLY, FACEBOOK_KEY_INBOX_ONLY);
StoreDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD);
+ StoreDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN);
+
+ int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, NULL, TRUE);
+ count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT);
+ proto->setByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, count);
BOOL setStatus = IsDlgButtonChecked(hwnd, IDC_SET_STATUS);
BOOL setStatusOld = proto->getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 6f08cbed47..c588e6c192 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -441,12 +441,14 @@ void FacebookProto::LoadLastMessages(void *p)
std::string id = utils::url::encode(std::string(item_id));
std::string type = isChat ? "thread_ids" : "user_ids";
+ int count = getByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, DEFAULT_MESSAGES_ON_OPEN_COUNT);
+ count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT);
// request messages from thread
data += "&messages[" + type + "][" + id;
data += "][offset]=0";
data += "&messages[" + type + "][" + id;
- data += "][limit]=30";
+ data += "][limit]=" + utils::conversion::to_string(&count, UTILS_CONV_UNSIGNED_NUMBER);
// request info about thread
data += "&threads[" + type + "][0]=" + id;
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 4880f4c7c2..d97aa419e1 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -535,6 +535,10 @@ int FacebookProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
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))
+ return 0;
+
// Load last messages for this contact
ForkThread(&FacebookProto::LoadLastMessages, new MCONTACT(event->hContact));
}
diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h
index 19958fceb4..b85c308376 100644
--- a/protocols/FacebookRM/src/resource.h
+++ b/protocols/FacebookRM/src/resource.h
@@ -32,6 +32,8 @@
#define IDC_LOAD_PAGES 1036
#define IDC_KEEP_UNREAD 1037
#define IDC_INBOX_ONLY 1038
+#define IDC_INBOX_ONLY2 1039
+#define IDC_MESSAGES_ON_OPEN 1039
#define IDC_NOTIFICATIONS_ENABLE 1041
#define IDC_FEEDS_ENABLE 1042
#define IDC_OTHER_ENABLE 1043
@@ -48,14 +50,16 @@
#define IDC_URL 1206
#define IDC_CCLIST 1207
#define IDC_CCLIST_LABEL 1208
+#define IDC_MESSAGES_COUNT 1209
+#define IDC_MESSAGES_COUNT_SPIN 1210
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 131
+#define _APS_NEXT_RESOURCE_VALUE 132
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1209
-#define _APS_NEXT_SYMED_VALUE 131
+#define _APS_NEXT_CONTROL_VALUE 1211
+#define _APS_NEXT_SYMED_VALUE 132
#endif
#endif
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index 37bb96716d..fee355323f 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
-#define __RELEASE_NUM 5
-#define __BUILD_NUM 1
+#define __RELEASE_NUM 6
+#define __BUILD_NUM 0
#include <stdver.h>