summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/utils.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-07-28 09:14:46 +0000
committerRobert Pösel <robyer@seznam.cz>2013-07-28 09:14:46 +0000
commit67f7907942b58a7b445e4da25c2398abb8db8572 (patch)
tree052d3dea556ae5d977e8561c9a90762edc2d0149 /protocols/FacebookRM/src/utils.cpp
parent6cefd27d57dc8a0806136703f4ff96420cfd43b4 (diff)
Facebook: Post status improvements (part 1) - ability to post URL attachments
git-svn-id: http://svn.miranda-ng.org/main/trunk@5502 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/utils.cpp')
-rw-r--r--protocols/FacebookRM/src/utils.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp
index 0a03ec29eb..3155c720f8 100644
--- a/protocols/FacebookRM/src/utils.cpp
+++ b/protocols/FacebookRM/src/utils.cpp
@@ -426,6 +426,45 @@ std::string utils::text::source_get_value2(std::string* data, const char *term,
return ret;
}
+std::string utils::text::source_get_form_data(std::string* data)
+{
+ std::string values = "";
+
+ std::string::size_type start = 0;
+ start = data->find("<input", start);
+ while (start != std::string::npos) {
+ start++;
+ std::string attr = "", value = "";
+
+ std::string::size_type pos = data->find("name=\"", start);
+ if (pos != std::string::npos) {
+ pos += 6;
+ std::string::size_type end = data->find("\"", pos);
+ if (end != std::string::npos)
+ attr = data->substr(pos, end - pos);
+
+
+ end = data->find(">", pos);
+ pos = data->find("value=\"", pos);
+ if (pos != std::string::npos && end != std::string::npos && pos < end) {
+ pos += 7;
+ end = data->find("\"", pos);
+ if (end != std::string::npos)
+ value = data->substr(pos, end - pos);
+ }
+ }
+
+ if (!attr.empty()) {
+ if (!values.empty())
+ values += "&";
+ values += attr + "=" + value;
+ }
+ start = data->find("<input", start);
+ }
+
+ return values;
+}
+
int utils::number::random()
{
srand(::time(NULL));