summaryrefslogtreecommitdiff
path: root/protocols/Tlen/src/jabber_util.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-16 14:34:41 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-16 14:34:41 +0000
commit35489ce3659220b4ebd25d1b3ab0258115cf10a4 (patch)
tree611d9ebaa2f85129af43492368381c55ccbb1a5e /protocols/Tlen/src/jabber_util.cpp
parent2611fbb22f7e186cb989f2b16133dad5215e41e1 (diff)
Tlen:
- custom base64 removed; - strict prototype verification git-svn-id: http://svn.miranda-ng.org/main/trunk@5719 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tlen/src/jabber_util.cpp')
-rw-r--r--protocols/Tlen/src/jabber_util.cpp137
1 files changed, 0 insertions, 137 deletions
diff --git a/protocols/Tlen/src/jabber_util.cpp b/protocols/Tlen/src/jabber_util.cpp
index a05c16d87a..71a18155b6 100644
--- a/protocols/Tlen/src/jabber_util.cpp
+++ b/protocols/Tlen/src/jabber_util.cpp
@@ -26,47 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
#include <win2k.h>
-
-HANDLE HookEventObj_Ex(const char *name, TlenProtocol *proto, MIRANDAHOOKOBJ hook)
-{
- proto->hookNum ++;
- proto->hHooks = (HANDLE *) mir_realloc(proto->hHooks, sizeof(HANDLE) * (proto->hookNum));
- proto->hHooks[proto->hookNum - 1] = HookEventObj(name, hook, proto);
- return proto->hHooks[proto->hookNum - 1] ;
-}
-
-
-HANDLE CreateServiceFunction_Ex(const char *name, TlenProtocol *proto, MIRANDASERVICEOBJ service) {
- proto->serviceNum++;
- proto->hServices = (HANDLE *) mir_realloc(proto->hServices, sizeof(HANDLE) * (proto->serviceNum));
- proto->hServices[proto->serviceNum - 1] = CreateServiceFunctionObj(name, service, proto);
- return proto->hServices[proto->serviceNum - 1] ;
-}
-
-void UnhookEvents_Ex(TlenProtocol *proto) {
- unsigned int i;
- for (i=0; i<proto->hookNum; ++i) {
- if (proto->hHooks[i] != NULL) {
- UnhookEvent(proto->hHooks[i]);
- }
- }
- mir_free(proto->hHooks);
- proto->hookNum = 0;
- proto->hHooks = NULL;
-}
-
-void DestroyServices_Ex(TlenProtocol *proto) {
- unsigned int i;
- for (i=0; i<proto->serviceNum; ++i) {
- if (proto->hServices[i] != NULL) {
- DestroyServiceFunction(proto->hServices[i]);
- }
- }
- mir_free(proto->hServices);
- proto->serviceNum = 0;
- proto->hServices = NULL;
-}
-
void JabberSerialInit(TlenProtocol *proto)
{
InitializeCriticalSection(&proto->csSerial);
@@ -420,102 +379,6 @@ char *JabberTextDecode(const char *str)
return s1;
}
-static char b64table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-char *JabberBase64Encode(const char *buffer, int bufferLen)
-{
- int n;
- unsigned char igroup[3];
- char *p, *peob;
- char *res, *r;
-
- if (buffer == NULL || bufferLen <= 0) return NULL;
- if ((res=(char *) mir_alloc((((bufferLen+2)/3)*4) + 1)) == NULL) return NULL;
-
- for (p=(char*)buffer,peob=p+bufferLen,r=res; p<peob;) {
- igroup[0] = igroup[1] = igroup[2] = 0;
- for (n=0; n<3; n++) {
- if (p >= peob) break;
- igroup[n] = (unsigned char) *p;
- p++;
- }
- if (n > 0) {
- r[0] = b64table[ igroup[0]>>2 ];
- r[1] = b64table[ ((igroup[0]&3)<<4) | (igroup[1]>>4) ];
- r[2] = b64table[ ((igroup[1]&0xf)<<2) | (igroup[2]>>6) ];
- r[3] = b64table[ igroup[2]&0x3f ];
- if (n < 3) {
- r[3] = '=';
- if (n < 2)
- r[2] = '=';
- }
- r += 4;
- }
- }
- *r = '\0';
-
- return res;
-}
-
-static unsigned char b64rtable[256];
-
-char *JabberBase64Decode(const char *str, int *resultLen)
-{
- char *res;
- unsigned char *p, *r, igroup[4], a[4];
- int n, num, count;
-
- if (str == NULL || resultLen == NULL) return NULL;
- if ((res=(char *) mir_alloc(((strlen(str)+3)/4)*3)) == NULL) return NULL;
-
- for (n=0; n<256; n++)
- b64rtable[n] = (unsigned char) 0x80;
- for (n=0; n<26; n++)
- b64rtable['A'+n] = n;
- for (n=0; n<26; n++)
- b64rtable['a'+n] = n + 26;
- for (n=0; n<10; n++)
- b64rtable['0'+n] = n + 52;
- b64rtable['+'] = 62;
- b64rtable['/'] = 63;
- b64rtable['='] = 0;
- count = 0;
- for (p=(unsigned char *)str,r=(unsigned char *)res; *p != '\0';) {
- for (n=0; n<4; n++) {
- if ( *p == '\r' || *p == '\n' ) {
- n--; p++;
- continue;
- }
-
- if ( *p=='\0' ) {
- if ( n == 0 )
- goto LBL_Exit;
- mir_free( res );
- return NULL;
- }
-
- if ( b64rtable[*p] == 0x80 ) {
- mir_free( res );
- return NULL;
- }
-
- a[n] = *p;
- igroup[n] = b64rtable[*p];
- p++;
- }
- r[0] = igroup[0]<<2 | igroup[1]>>4;
- r[1] = igroup[1]<<4 | igroup[2]>>2;
- r[2] = igroup[2]<<6 | igroup[3];
- r += 3;
- num = ( a[2] == '='?1:( a[3] == '='?2:3 ));
- count += num;
- if ( num < 3 ) break;
- }
-LBL_Exit:
- *resultLen = count;
- return res;
-}
-
/*
* Apply Polish Daylight Saving Time rules to get "DST-unbiased" timestamp
*/