diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-28 12:01:09 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-28 12:01:09 +0000 |
commit | 2e2d9de08e3eb747f88cd3a9aeb750a3c34078a7 (patch) | |
tree | 7b0774375566185dc27d708b2d7aadd8f9a81eca /protocols/FacebookRM | |
parent | ae3cee537d478fba0f32e561a12d62213a85a4d5 (diff) |
code adaptation for getTStringA
git-svn-id: http://svn.miranda-ng.org/main/trunk@5508 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/contacts.cpp | 50 | ||||
-rw-r--r-- | protocols/FacebookRM/src/dialogs.cpp | 42 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 14 |
3 files changed, 53 insertions, 53 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 6f57f221aa..794455f6c2 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -79,14 +79,14 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo if(CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0)
{
setString(hContact, FACEBOOK_KEY_ID, fbu->user_id.c_str());
-
+
std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id;
- setString(hContact, "Homepage", homepage.c_str());
+ setString(hContact, "Homepage", homepage.c_str());
setString(hContact, "MirVer", fbu->status_id == ID_STATUS_ONTHEPHONE ? FACEBOOK_MOBILE : FACEBOOK_NAME);
db_unset(hContact, "CList", "MyHandle");
- ptrT group = db_get_tsa(NULL, m_szModuleName, FACEBOOK_KEY_DEF_GROUP);
+ ptrT group = getTStringA(NULL, FACEBOOK_KEY_DEF_GROUP);
if (group)
db_set_ts(hContact, "CList", "Group", group);
@@ -97,10 +97,10 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo if (fbu->gender)
setByte(hContact, "Gender", fbu->gender);
-
+
if (!fbu->image_url.empty())
setString(hContact, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
-
+
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, type);
if (getByte(FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, 0))
@@ -108,7 +108,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo return hContact;
}
-
+
CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0);
}
@@ -120,15 +120,15 @@ void FacebookProto::SetAllContactStatuses(int status, bool reset_client) for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (isChatRoom(hContact))
continue;
-
+
if (reset_client) {
- ptrT mirver = db_get_tsa(hContact, m_szModuleName, "MirVer");
+ ptrT mirver = getTStringA(hContact, "MirVer");
if (!mirver || _tcscmp(mirver, _T(FACEBOOK_NAME)))
setTString(hContact, "MirVer", _T(FACEBOOK_NAME));
/*std::tstring foldername = GetAvatarFolder() + L"\\smileys\\";
TCHAR *path = _tcsdup(foldername.c_str());
-
+
if (getByte(FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
@@ -154,14 +154,14 @@ void FacebookProto::DeleteContactFromServer(void *data) std::string id = (*(std::string*)data);
delete data;
-
+
std::string query = "norefresh=true&unref=button_dropdown&confirmed=1&phstamp=0&__a=1";
query += "&fb_dtsg=" + facy.dtsg_;
query += "&uid=" + id;
- query += "&__user=" + facy.self_.user_id;
+ query += "&__user=" + facy.self_.user_id;
std::string get_query = "norefresh=true&unref=button_dropdown&uid=" + id;
-
+
// Get unread inbox threads
http::response resp = facy.flap(REQUEST_DELETE_FRIEND, &query, &get_query);
@@ -169,27 +169,27 @@ void FacebookProto::DeleteContactFromServer(void *data) facy.validate_response(&resp);
if (resp.data.find("\"payload\":null", 0) != std::string::npos)
- {
+ {
facebook_user* fbu = facy.buddies.find(id);
if (fbu != NULL)
fbu->deleted = true;
- HANDLE hContact = ContactIDToHContact(id);
-
+ HANDLE hContact = ContactIDToHContact(id);
+
// If contact wasn't deleted from database
if (hContact != NULL) {
setWord(hContact, "Status", ID_STATUS_OFFLINE);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
setDword(hContact, FACEBOOK_KEY_DELETED, ::time(NULL));
}
-
+
NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_OTHER);
} else {
facy.client_notify(TranslateT("Error occured when removing contact from server."));
}
if (resp.code != HTTP_CODE_OK)
- facy.handle_error("DeleteContactFromServer");
+ facy.handle_error("DeleteContactFromServer");
}
void FacebookProto::AddContactToServer(void *data)
@@ -201,7 +201,7 @@ void FacebookProto::AddContactToServer(void *data) std::string id = (*(std::string*)data);
delete data;
-
+
std::string query = "action=add_friend&how_found=profile_button&ref_param=ts&outgoing_id=&unwanted=&logging_location=&no_flyout_on_click=false&ego_log_data=&lsd=";
query += "&fb_dtsg=" + facy.dtsg_;
query += "&to_friend=" + id;
@@ -214,12 +214,12 @@ void FacebookProto::AddContactToServer(void *data) facy.validate_response(&resp);
if (resp.data.find("\"success\":true", 0) != std::string::npos) {
- HANDLE hContact = ContactIDToHContact(id);
-
+ HANDLE hContact = ContactIDToHContact(id);
+
// If contact wasn't deleted from database
if (hContact != NULL)
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_REQUEST);
-
+
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_OTHER);
}
else facy.client_notify(TranslateT("Error occured when requesting friendship."));
@@ -264,8 +264,8 @@ void FacebookProto::CancelFriendsRequest(void *data) HANDLE hContact = (*(HANDLE*)data);
delete data;
-
- std::string query = "phstamp=0&confirmed=1";
+
+ std::string query = "phstamp=0&confirmed=1";
query += "&fb_dtsg=" + facy.dtsg_;
query += "&__user=" + facy.self_.user_id;
@@ -279,7 +279,7 @@ void FacebookProto::CancelFriendsRequest(void *data) facy.validate_response(&resp);
if (resp.data.find("\"payload\":null", 0) != std::string::npos)
- {
+ {
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_OTHER);
}
@@ -311,7 +311,7 @@ void FacebookProto::SendPokeWorker(void *p) facy.validate_response(&resp);
if (resp.data.find("\"payload\":null", 0) != std::string::npos) {
-
+
std::string message = utils::text::special_expressions_decode(
utils::text::remove_html(
utils::text::slashu_to_utf8(
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index f1ed65eebc..a9b3ad6097 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -127,7 +127,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara SendDlgItemMessage(hwnd,IDC_MINDMSG,EM_LIMITTEXT,FACEBOOK_MIND_LIMIT,0);
SendDlgItemMessage(hwnd,IDC_URL,EM_LIMITTEXT,1024,0);
- ptrT place = db_get_tsa(NULL, proto->m_szModuleName, FACEBOOK_KEY_PLACE);
+ ptrT place = proto->getTStringA(FACEBOOK_KEY_PLACE);
SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : _T("Miranda NG"));
for(size_t i=0; i<SIZEOF(privacy_types); i++)
@@ -191,7 +191,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara //char *narrow = mir_t2a_cp(mindMessage,CP_UTF8);
proto->ForkThread(&FacebookProto::SetAwayMsgWorker, data);
- EndDialog(hwnd, wparam);
+ EndDialog(hwnd, wparam);
return TRUE;
}
else if (LOWORD(wparam) == IDCANCEL)
@@ -262,10 +262,10 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return TRUE;
}
- if (LOWORD(wparam) == IDC_SECURE) {
+ if (LOWORD(wparam) == IDC_SECURE) {
EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
- }
-
+ }
+
if ((LOWORD(wparam)==IDC_UN || LOWORD(wparam)==IDC_PW || LOWORD(wparam)==IDC_GROUP) &&
(HIWORD(wparam)!=EN_CHANGE || (HWND)lparam!=GetFocus()))
return 0;
@@ -297,7 +297,7 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
StoreDBCheckState(proto, hwnd, IDC_LOAD_MOBILE, FACEBOOK_KEY_LOAD_MOBILE);
-
+
return TRUE;
}
break;
@@ -332,7 +332,7 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L LoadDBCheckState(proto, hwnd, IDC_LOGGING, FACEBOOK_KEY_LOGGING_ENABLE, DEFAULT_LOGGING_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES);
LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS);
-
+
LoadDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP, 0);
EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
@@ -341,15 +341,15 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L }
case WM_COMMAND: {
- if (LOWORD(wparam) == IDC_SECURE) {
+ if (LOWORD(wparam) == IDC_SECURE) {
EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
- }
-
+ }
+
if (LOWORD(wparam) == IDC_SECURE_CHANNEL && IsDlgButtonChecked(hwnd, IDC_SECURE_CHANNEL))
MessageBox(hwnd, TranslateT("Note: Make sure you have disabled 'Validate SSL certificates' option in Network options to work properly."), proto->m_tszUserName, MB_OK);
SendMessage(GetParent(hwnd),PSM_CHANGED,0,0);
-
+
break;
}
@@ -365,7 +365,7 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L StoreDBCheckState(proto, hwnd, IDC_MAP_STATUSES, FACEBOOK_KEY_MAP_STATUSES);
StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS);
StoreDBCheckState(proto, hwnd, IDC_USE_LOCAL_TIME, FACEBOOK_KEY_LOCAL_TIMESTAMP);
-
+
BOOL setStatus = IsDlgButtonChecked(hwnd, IDC_SET_STATUS);
BOOL setStatusOld = proto->getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
if (setStatus != setStatusOld)
@@ -378,7 +378,7 @@ INT_PTR CALLBACK FBOptionsAdvancedProc(HWND hwnd, UINT message, WPARAM wparam, L return TRUE;
}
- break;
+ break;
}
return FALSE;
@@ -389,7 +389,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa {
FacebookProto *proto = reinterpret_cast<FacebookProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- switch(message)
+ switch(message)
{
case WM_INITDIALOG:
@@ -397,7 +397,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa TranslateDialogDefault(hwnd);
proto = reinterpret_cast<FacebookProto*>(lparam);
- SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
+ SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
for(size_t i=0; i<SIZEOF(feed_types); i++)
{
@@ -448,10 +448,10 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa {
TCHAR protoName[255];
lstrcpy(protoName, proto->m_tszUserName);
- proto->NotifyEvent(protoName, TranslateT("Sample event"), NULL, FACEBOOK_EVENT_CLIENT);
- proto->NotifyEvent(protoName, TranslateT("Sample request"), NULL, FACEBOOK_EVENT_OTHER);
- proto->NotifyEvent(protoName, TranslateT("Sample newsfeed"), NULL, FACEBOOK_EVENT_NEWSFEED);
- proto->NotifyEvent(protoName, TranslateT("Sample notification"), NULL, FACEBOOK_EVENT_NOTIFICATION);
+ proto->NotifyEvent(protoName, TranslateT("Sample event"), NULL, FACEBOOK_EVENT_CLIENT);
+ proto->NotifyEvent(protoName, TranslateT("Sample request"), NULL, FACEBOOK_EVENT_OTHER);
+ proto->NotifyEvent(protoName, TranslateT("Sample newsfeed"), NULL, FACEBOOK_EVENT_NEWSFEED);
+ proto->NotifyEvent(protoName, TranslateT("Sample notification"), NULL, FACEBOOK_EVENT_NOTIFICATION);
} break;
case IDC_COLTEXT:
@@ -476,7 +476,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa case WM_NOTIFY:
{
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
- {
+ {
proto->setByte(FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
StoreDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY);
@@ -494,7 +494,7 @@ INT_PTR CALLBACK FBEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpa proto->setDword(FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK,CPM_GETCOLOUR,0,0));
proto->setDword(FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT,CPM_GETCOLOUR,0,0));
proto->setDword(FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT,NULL,TRUE));
-
+
proto->setDword(FACEBOOK_KEY_EVENT_FEEDS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK2,CPM_GETCOLOUR,0,0));
proto->setDword(FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT2,CPM_GETCOLOUR,0,0));
proto->setDword(FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT2,NULL,TRUE));
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index a00e4e45e9..c4cebb6629 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -204,7 +204,7 @@ int FacebookProto::SetAwayMsg(int status, const PROTOCHAR *msg) }
void FacebookProto::SetAwayMsgWorker(void *p)
-{
+{
if (p != NULL) {
status_data *data = static_cast<status_data*>(p);
facy.post_status(data);
@@ -544,7 +544,7 @@ INT_PTR FacebookProto::Poke(WPARAM wParam,LPARAM lParam) ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
if (id == NULL)
return 1;
-
+
ForkThread(&FacebookProto::SendPokeWorker, new std::string(id));
return 0;
}
@@ -562,9 +562,9 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) if ( isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) != CONTACT_FRIEND))
return 0;
- ptrT tname = db_get_tsa(hContact, m_szModuleName, FACEBOOK_KEY_NAME);
+ ptrT tname( getTStringA(hContact, FACEBOOK_KEY_NAME));
if (tname == NULL)
- tname = db_get_tsa(hContact, m_szModuleName, FACEBOOK_KEY_ID);
+ tname = getTStringA(hContact, FACEBOOK_KEY_ID);
TCHAR tstr[256];
mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), tname);
@@ -598,7 +598,7 @@ INT_PTR FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) ptrA id( getStringA(hContact, FACEBOOK_KEY_ID));
if (id == NULL)
return 1;
-
+
ForkThread(&FacebookProto::AddContactToServer, new std::string(id));
return 0;
}
@@ -656,7 +656,7 @@ void FacebookProto::OpenUrl(std::string url) // Make realtive url
if (!isRelativeUrl) {
url = url.substr(pos + facebookDomain.length());
-
+
// Strip eventual port
pos = url.find("/");
if (pos != std::string::npos && pos != 0)
@@ -684,6 +684,6 @@ void FacebookProto::ReadNotificationWorker(void *p) data += "&__user=" + facy.self_.user_id;
facy.flap(REQUEST_NOTIFICATIONS_READ, NULL, &data);
-
+
delete p;
}
\ No newline at end of file |