summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/utils.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-03-15 10:22:11 +0000
committerRobert Pösel <robyer@seznam.cz>2014-03-15 10:22:11 +0000
commit7846764cedc3ebc2827e891d683fec31e2149baa (patch)
tree1cb561f95f6d46e7f62ccd022637b5bc9bf78065 /protocols/FacebookRM/src/utils.cpp
parent9ba2c4ec23e4079b69988719b56d8dd2f5d132ae (diff)
Facebook: use clientid parameter in channel requests (fixes #536), version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@8613 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/utils.cpp')
-rw-r--r--protocols/FacebookRM/src/utils.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp
index 81a0826239..4da9cd44e0 100644
--- a/protocols/FacebookRM/src/utils.cpp
+++ b/protocols/FacebookRM/src/utils.cpp
@@ -450,8 +450,19 @@ std::string utils::text::source_get_form_data(std::string* data)
return values;
}
-int utils::number::random()
+std::string utils::text::rand_string(int len, const char *chars)
{
+ std::stringstream out;
+
srand(::time(NULL));
- return rand();
+ for (int i = 0; i < len; ++i) {
+ out << chars[utils::number::random(0, strlen(chars))];
+ }
+
+ return out.str();
+}
+
+int utils::number::random(int min, int max)
+{
+ return (rand() % (max - min)) + min;
}