summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-23 13:28:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-23 13:28:20 +0000
commit20a19cd84f00a2235e1ab000921ae58ace13faa9 (patch)
treed6477be5e1ce781398c9c69a8065112427da1a82
parent12d981da28a6a35dbdcd4d207dc4497f902f287d (diff)
Facebook: proper default group's name handling
git-svn-id: http://svn.miranda-ng.org/main/trunk@11595 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/FacebookRM/src/connection.cpp5
-rw-r--r--protocols/FacebookRM/src/contacts.cpp5
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp11
-rw-r--r--protocols/FacebookRM/src/proto.cpp6
-rw-r--r--protocols/FacebookRM/src/proto.h2
5 files changed, 18 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 387dfe99cf..9dce31dae5 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -190,9 +190,8 @@ bool FacebookProto::NegotiateConnection()
facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef");
// Create default group for new contacts
- ptrT groupName(getTStringA(FACEBOOK_KEY_DEF_GROUP));
- if (groupName != NULL)
- Clist_CreateGroup(0, groupName);
+ if (m_tszDefaultGroup)
+ Clist_CreateGroup(0, m_tszDefaultGroup);
return facy.login(username, password);
}
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index a7196e5653..69db741249 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -364,9 +364,8 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, b
db_unset(hContact, "CList", "MyHandle");
- ptrT group(getTStringA(NULL, FACEBOOK_KEY_DEF_GROUP));
- if (group)
- db_set_ts(hContact, "CList", "Group", group);
+ if (m_tszDefaultGroup)
+ db_set_ts(hContact, "CList", "Group", m_tszDefaultGroup);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, type);
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index d6a94a4f1a..36774e2ca5 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -370,9 +370,8 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0);
- ptrT group(db_get_tsa(NULL, proto->ModuleName(), FACEBOOK_KEY_DEF_GROUP));
- if (group != NULL)
- SetDlgItemText(hwnd, IDC_GROUP, group);
+ if (proto->m_tszDefaultGroup != NULL)
+ SetDlgItemText(hwnd, IDC_GROUP, proto->m_tszDefaultGroup);
LoadDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, DEFAULT_DISABLE_STATUS_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
@@ -419,10 +418,14 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr));
if (tstr[0] != '\0')
{
+ proto->m_tszDefaultGroup = mir_tstrdup(tstr);
proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr);
Clist_CreateGroup(0, tstr);
}
- else proto->delSetting(FACEBOOK_KEY_DEF_GROUP);
+ else {
+ proto->delSetting(FACEBOOK_KEY_DEF_GROUP);
+ proto->m_tszDefaultGroup = NULL;
+ }
StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index cb070adb20..fae1246351 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -23,7 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) :
-PROTO<FacebookProto>(proto_name, username)
+ PROTO<FacebookProto>(proto_name, username),
+ m_tszDefaultGroup(getTStringA(FACEBOOK_KEY_DEF_GROUP))
{
facy.parent = this;
@@ -48,6 +49,9 @@ PROTO<FacebookProto>(proto_name, username)
if (locale != NULL)
m_locale = locale;
+ if (m_tszDefaultGroup == NULL)
+ m_tszDefaultGroup = mir_tstrdup(_T("Facebook"));
+
CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg);
CreateProtoService(PS_GETMYAVATART, &FacebookProto::GetMyAvatar);
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 48249a1609..dea4fc9682 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -251,6 +251,8 @@ public:
HANDLE log_lock_;
HANDLE update_loop_lock_;
+ ptrT m_tszDefaultGroup;
+
std::vector<HANDLE> popupClasses;
std::string last_status_msg_;