summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_utils.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-12-20 17:25:21 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-12-20 17:25:21 +0000
commit5e77e8a1665382c76fee1bc3ca12e44aca9af2e7 (patch)
tree9d2d8d2710a15c6e5e407b8a9ef5aa0cdce7b857 /protocols/Skype/src/skype_utils.cpp
parent27b52fd25b336a52cfd74d6ef74ed382a110a791 (diff)
- third approach of group chat support
- added connection options - fixed connection via proxy git-svn-id: http://svn.miranda-ng.org/main/trunk@2772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_utils.cpp')
-rw-r--r--protocols/Skype/src/skype_utils.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 73df520aa0..5fdcb0dff1 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -473,4 +473,55 @@ void CSkypeProto::ShowNotification(const char *nick, const wchar_t *message, int
::CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0);
}
+}
+
+char CSkypeProto::CharBase64[] =
+{
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M ','N','O','P',
+ 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c ','d','e','f',
+ 'g','h','i','j','k','l','m','n','o','p','q','r','s ','t','u','v',
+ 'w','x','y','z','0','1','2','3','4','5','6','7','8 ','9','+','/'
+};
+
+ULONG CSkypeProto::Base64Encode(char *inputString, char *outputBuffer, SIZE_T nMaxLength)
+{
+ int outpos = 0;
+ char chr[3], enc[4];
+
+ for (uint i = 0; i < ::strlen(inputString); i += 3)
+ {
+ if (outpos + 4 >= nMaxLength)
+ break;
+
+ chr[0] = inputString[i];
+ chr[1] = inputString[i+1];
+ chr[2] = inputString[i+2];
+
+ enc[0] = chr[0] >> 2;
+ enc[1] = ((chr[0] & 0x03) << 4) | (chr[1] >> 4);
+ enc[2] = ((chr[1] & 0x0F) << 2) | (chr[2] >> 6);
+ enc[3] = chr[2] & 0x3F;
+
+ outputBuffer[outpos++] = CSkypeProto::CharBase64[enc[0]];
+ outputBuffer[outpos++] = CSkypeProto::CharBase64[enc[1]];
+
+ if (i + 1 >= ::strlen(inputString))
+ {
+ outputBuffer[outpos++] = '=';
+ outputBuffer[outpos++] = '=';
+ }
+ else if (i + 2 >= ::strlen(inputString))
+ {
+ outputBuffer[outpos++] = CSkypeProto::CharBase64[enc[2]];
+ outputBuffer[outpos++] = '=';
+ }
+ else
+ {
+ outputBuffer[outpos++] = CSkypeProto::CharBase64[enc[2]];
+ outputBuffer[outpos++] = CSkypeProto::CharBase64[enc[3]];
+ }
+ }
+
+ outputBuffer[outpos] = 0;
+ return outpos;
} \ No newline at end of file