summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/messages.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-06-04 07:55:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-06-04 07:55:00 +0000
commit8751885ea79df4b666b65bb2b6900617785e0da7 (patch)
tree676db28129ece760d7ad354b2d39ba371453db8c /protocols/FacebookRM/src/messages.cpp
parent09476981eccbcae37ef4526f3fbcb18fca686ffa (diff)
end of base64* zoo
git-svn-id: http://svn.miranda-ng.org/main/trunk@4879 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/messages.cpp')
-rw-r--r--protocols/FacebookRM/src/messages.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index 2893d62016..dfa04d338d 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -214,15 +214,7 @@ void FacebookProto::ParseSmileys(std::string message, HANDLE hContact)
std::string url = "http://graph.facebook.com/%s/picture";
utils::text::replace_first(&url, "%s", smiley.substr(2, smiley.length()-4));
-
- size_t slen = smiley.length();
- size_t rlen = Netlib_GetBase64EncodedBufferSize(slen);
- char* buf = (char*)mir_alloc(rlen);
-
- NETLIBBASE64 nlb = { buf, (int)rlen, (PBYTE)smiley.c_str(), (int)slen };
- CallService(MS_NETLIB_BASE64ENCODE, 0, LPARAM(&nlb));
-
- std::string b64 = buf;
+ std::string b64 = ptrA( mir_base64_encode((PBYTE)smiley.c_str(), (unsigned)smiley.length()));
b64 = utils::url::encode(b64);
std::tstring filename = GetAvatarFolder() + L"\\smileys\\" + (TCHAR*)_A2T(b64.c_str()) + _T(".jpg");
@@ -232,16 +224,15 @@ void FacebookProto::ParseSmileys(std::string message, HANDLE hContact)
} else {
facy.save_url(url, filename, nlc);
}
- TCHAR *path = _tcsdup(filename.c_str());
+ TCHAR *path = _tcsdup(filename.c_str());
- SMADD_CONT cont;
- cont.cbSize = sizeof(SMADD_CONT);
- cont.hContact = hContact;
- cont.type = 1;
- cont.path = path;
+ SMADD_CONT cont;
+ cont.cbSize = sizeof(SMADD_CONT);
+ cont.hContact = hContact;
+ cont.type = 1;
+ cont.path = path;
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont);
- mir_free(path);
- //}
+ CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont);
+ mir_free(path);
}
}