summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-31 09:54:49 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-31 09:54:49 +0000
commit908e2498da725561fe9b3eb47f0f5f6e95bbb8ac (patch)
treece8a9673e07d30d30b4c1cdcde1b8c8357fb5269 /protocols
parent21290b61b2e1f608d046ba9be0a1dd8b7132ce46 (diff)
Facebook: !length() -> empty()
git-svn-id: http://svn.miranda-ng.org/main/trunk@9375 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/communication.cpp26
-rw-r--r--protocols/FacebookRM/src/process.cpp10
2 files changed, 18 insertions, 18 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 4cbe5efc89..238da89732 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -705,11 +705,11 @@ void loginError(FacebookProto *proto, std::string error_str) {
utils::text::remove_html(
utils::text::edit_html(error_str))));
- proto->debugLogA(" ! ! Login error: %s", error_str.length() ? error_str.c_str() : "Unknown error");
+ proto->debugLogA(" ! ! Login error: %s", !error_str.empty() ? error_str.c_str() : "Unknown error");
TCHAR buf[200];
mir_sntprintf(buf, SIZEOF(buf), TranslateT("Login error: %s"),
- (!error_str.length()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str())));
+ (error_str.empty()) ? TranslateT("Unknown error") : ptrT(mir_utf8decodeT(error_str.c_str())));
proto->facy.client_notify(buf);
}
@@ -743,7 +743,7 @@ bool facebook_client::login(const char *username, const char *password)
http::response resp = flap(REQUEST_LOGIN, &data);
// Save Device ID
- if (cookies["datr"].length())
+ if (!cookies["datr"].empty())
parent->setString(FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str());
if (resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end())
@@ -871,7 +871,7 @@ bool facebook_client::logout()
handle_entry("logout");
- std::string data = "fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0");
+ std::string data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0");
data += "&ref=mb&h=" + this->logout_hash_;
http::response resp = flap(REQUEST_LOGOUT, &data);
@@ -973,7 +973,7 @@ bool facebook_client::chat_state(bool online)
std::string data = (online ? "visibility=1" : "visibility=0");
data += "&window_id=0";
- data += "&fb_dtsg=" + (dtsg_.length() ? dtsg_ : "0");
+ data += "&fb_dtsg=" + (!dtsg_.empty() ? dtsg_ : "0");
data += "&phstamp=0&__user=" + self_.user_id;
http::response resp = flap(REQUEST_VISIBILITY, &data);
@@ -1096,7 +1096,7 @@ bool facebook_client::send_message(MCONTACT hContact, std::string message_recipi
data += "&recipients[0]=" + message_recipient;
data += "&__user=" + this->self_.user_id;
data += "&__a=1";
- data += "&fb_dtsg=" + (dtsg_.length() ? dtsg_ : "0");
+ data += "&fb_dtsg=" + (!dtsg_.empty() ? dtsg_ : "0");
data += "&phstamp=0";
resp = flap(REQUEST_MESSAGE_SEND2, &data);
@@ -1128,7 +1128,7 @@ bool facebook_client::send_message(MCONTACT hContact, std::string message_recipi
data += "&message_batch[0][message_id]";
data += "&message_batch[0][client_thread_id]=user:" + message_recipient;
data += "&client=mercury";
- data += "&fb_dtsg=" + (dtsg_.length() ? dtsg_ : "0");
+ data += "&fb_dtsg=" + (!dtsg_.empty() ? dtsg_ : "0");
data += "&__user=" + this->self_.user_id;
data += "&__a=1";
data += "&phstamp=0";
@@ -1153,7 +1153,7 @@ bool facebook_client::send_message(MCONTACT hContact, std::string message_recipi
data += "&message_batch[0][has_attachment]=false";
data += "&message_batch[0][is_html]=false";
data += "&message_batch[0][message_id]=";
- data += "&fb_dtsg=" + (dtsg_.length() ? dtsg_ : "0");
+ data += "&fb_dtsg=" + (!dtsg_.empty() ? dtsg_ : "0");
data += "&__user=" + this->self_.user_id;
data += "&phstamp=0";
@@ -1167,7 +1167,7 @@ bool facebook_client::send_message(MCONTACT hContact, std::string message_recipi
data += "&body=" + utils::url::encode(message_text);
data += "&recipients[0]=" + message_recipient;
data += "&lsd=";
- data += "&fb_dtsg=" + (dtsg_.length() ? dtsg_ : "0");
+ data += "&fb_dtsg=" + (!dtsg_.empty() ? dtsg_ : "0");
resp = flap(REQUEST_ASYNC, &data);
break;
@@ -1230,7 +1230,7 @@ bool facebook_client::post_status(status_data *status)
handle_entry("post_status");
if (status->isPage) {
- std::string data = "fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0");
+ std::string data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0");
data += "&user_id=" + status->user_id;
data += "&url=" + std::string(FACEBOOK_URL_HOMEPAGE);
flap(REQUEST_IDENTITY_SWITCH, &data);
@@ -1240,7 +1240,7 @@ bool facebook_client::post_status(status_data *status)
RequestType request = REQUEST_POST_STATUS;
if (!status->url.empty()) {
- data = "fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0");
+ data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0");
data += "&composerid=u_jsonp_2_b";
data += "&targetid=" + (status->user_id.empty() ? this->self_.user_id : status->user_id);
data += "&istimeline=1&composercontext=composer&onecolumn=1&nctr[_mod]=pagelet_timeline_recent&__a=1&ttstamp=0";
@@ -1260,7 +1260,7 @@ bool facebook_client::post_status(status_data *status)
std::string text = utils::url::encode(status->text);
- data += "fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0");
+ data += "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0");
data += "&xhpc_targetid=" + (status->user_id.empty() ? this->self_.user_id : status->user_id);
data += "&__user=" + (status->isPage && !status->user_id.empty() ? status->user_id : this->self_.user_id);
data += "&xhpc_message=" + text;
@@ -1285,7 +1285,7 @@ bool facebook_client::post_status(status_data *status)
http::response resp = flap(request, &data);
if (status->isPage) {
- std::string data = "fb_dtsg=" + (this->dtsg_.length() ? this->dtsg_ : "0");
+ std::string data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0");
data += "&user_id=" + this->self_.user_id;
data += "&url=" + std::string(FACEBOOK_URL_HOMEPAGE);
flap(REQUEST_IDENTITY_SWITCH, &data);
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 65175c263e..1181b326ee 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -284,7 +284,7 @@ void FacebookProto::ProcessUnreadMessages(void*)
data += "&folders[1]=other";
data += "&client=mercury";
data += "__user=" + facy.self_.user_id;
- data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
+ data += "&fb_dtsg=" + (!facy.dtsg_.empty() ? facy.dtsg_ : "0");
data += "&__a=1&__dyn=&__req=&ttstamp=0";
http::response resp = facy.flap(REQUEST_UNREAD_THREADS, &data);
@@ -338,7 +338,7 @@ void FacebookProto::ProcessUnreadMessage(void *p)
while (!threads.empty()) {
std::string data = "client=mercury";
data += "&__user=" + facy.self_.user_id;
- data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
+ data += "&fb_dtsg=" + (!facy.dtsg_.empty() ? facy.dtsg_ : "0");
data += "&__a=1&__dyn=&__req=&ttstamp=0";
for (std::vector<std::string>::size_type i = 0; i < threads.size(); i++) {
@@ -431,7 +431,7 @@ void FacebookProto::LoadLastMessages(void *p)
std::string data = "client=mercury";
data += "&__user=" + facy.self_.user_id;
- data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
+ data += "&fb_dtsg=" + (!facy.dtsg_.empty() ? facy.dtsg_ : "0");
data += "&__a=1&__dyn=&__req=&ttstamp=0";
bool isChat = isChatRoom(hContact);
@@ -799,7 +799,7 @@ void FacebookProto::ProcessFriendRequests(void*)
fbu->real_name = utils::text::source_get_value(&req, 2, "class=\"actor\">", "</");
fbu->user_id = utils::text::source_get_value(&get, 2, "id=", "&");
- if (fbu->user_id.length() && fbu->real_name.length())
+ if (!fbu->user_id.empty() && !fbu->real_name.empty())
{
MCONTACT hContact = AddToContactList(fbu, CONTACT_APPROVE);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_APPROVE);
@@ -980,7 +980,7 @@ void FacebookProto::ProcessFeeds(void* data)
utils::text::remove_html(
utils::text::edit_html(post_message))));
- if (filtered || !nf->title.length() || !nf->text.length()) {
+ if (filtered || nf->title.empty() || nf->text.empty()) {
debugLogA(" \\ Newsfeed (time: %d) is filtered: %s", ttime, filtered ? "advertisement" : (nf->title.empty() ? "title empty" : "text empty"));
delete nf;
continue;