summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-22 16:04:17 +0000
commite2c2a1f5a84c6c9b705dc85c6a2dd1f97edd57e4 (patch)
treeba79bdcede96f80039f8b88d2791f198b9ec2981 /protocols/FacebookRM
parentf8e34b5f83f3ce5f39d541e9068b6b8cb6d92acd (diff)
T2Utf - handy replacement for ptrA<mir_utf8decodeT()>
git-svn-id: http://svn.miranda-ng.org/main/trunk@13758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp6
-rw-r--r--protocols/FacebookRM/src/json.cpp4
-rw-r--r--protocols/FacebookRM/src/process.cpp11
-rw-r--r--protocols/FacebookRM/src/proto.cpp5
4 files changed, 11 insertions, 15 deletions
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index b736b2c239..771adf60bd 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -299,16 +299,16 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara
status->user_id = data->walls[wall_id]->user_id;
status->isPage = data->walls[wall_id]->isPage;
status->privacy = privacy_types[privacy_id].id;
- status->place = ptrA(mir_utf8encodeT(placeT));
+ status->place = T2Utf(placeT);
status->url = _T2A(urlT);
HWND hwndList = GetDlgItem(hwnd, IDC_CCLIST);
GetSelectedContacts(data->proto, NULL, hwndList, &status->users);
- ptrA narrow(mir_utf8encodeT(mindMessageT));
+ T2Utf narrow(mindMessageT);
status->text = narrow;
- if (status->user_id == data->proto->facy.self_.user_id && data->proto->last_status_msg_ != (char *)narrow)
+ if (status->user_id == data->proto->facy.self_.user_id && data->proto->last_status_msg_ != (char*)narrow)
data->proto->last_status_msg_ = narrow;
data->proto->ForkThread(&FacebookProto::SetAwayMsgWorker, status);
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index defcec4595..36dcc6aae9 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -378,12 +378,12 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, JSONNODE
TCHAR title[200];
mir_sntprintf(title, SIZEOF(title), TranslateT("User sent %s:"), newText.c_str());
- *message_text += ptrA(mir_utf8encodeT(title));
+ *message_text += T2Utf(title);
*message_text += attachments_text;
}
else {
// TODO: better support for these attachments (parse it from "m_messaging" instead of "messaging"
- *message_text += ptrA(mir_utf8encodeT(TranslateT("User sent an unsupported attachment. Open your browser to see it.")));
+ *message_text += T2Utf(TranslateT("User sent an unsupported attachment. Open your browser to see it."));
}
}
}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index af61679db4..e89049cd70 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* Helper function for loading name from database (or use default one specified as parameter), used for title of few notifications.
*/
-std::string getContactName(FacebookProto *proto, MCONTACT hContact, const char *defaultName) {
+std::string getContactName(FacebookProto *proto, MCONTACT hContact, const char *defaultName)
+{
std::string name = defaultName;
DBVARIANT dbv;
@@ -1225,8 +1226,7 @@ void FacebookProto::SearchAckThread(void *targ)
int count = 0;
- char *arg = mir_utf8encodeT((TCHAR*)targ);
- std::string search = utils::url::encode(arg);
+ std::string search = utils::url::encode(T2Utf((TCHAR *)targ).str());
std::string ssid;
while (count < 50 && !isOffline())
@@ -1300,15 +1300,13 @@ void FacebookProto::SearchAckThread(void *targ)
facy.handle_success("searchAckThread");
mir_free(targ);
- mir_free(arg);
}
void FacebookProto::SearchIdAckThread(void *targ)
{
facy.handle_entry("searchIdAckThread");
- char *arg = mir_utf8encodeT((TCHAR*)targ);
- std::string search = utils::url::encode(arg) + "?";
+ std::string search = utils::url::encode(T2Utf((TCHAR*)targ).str()) + "?";
if (!isOffline())
{
@@ -1358,5 +1356,4 @@ void FacebookProto::SearchIdAckThread(void *targ)
facy.handle_success("searchIdAckThread");
mir_free(targ);
- mir_free(arg);
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index afa5303574..7018e530ea 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -227,10 +227,9 @@ int FacebookProto::SetAwayMsg(int, const PROTOCHAR *msg)
return 0;
}
- char *narrow = mir_utf8encodeT(msg);
- if (last_status_msg_ != narrow)
+ T2Utf narrow(msg);
+ if (last_status_msg_ != (char*)narrow)
last_status_msg_ = narrow;
- mir_free(narrow);
if (isOnline() && getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS))
ForkThread(&FacebookProto::SetAwayMsgWorker, NULL);