00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef LIBEVAUTIL_H
00021 #define LIBEVAUTIL_H
00022
00023 #include <string>
00024 #include "md5.h"
00025 #define KEY_LENGTH 16
00026 #define QQ_SMILEY_AMOUNT 96
00027
00029 #ifdef WIN32
00030 #pragma warning(disable: 4309 4800)
00031 typedef unsigned int uint;
00032 typedef unsigned char uint8_t;
00033 #include <malloc.h>
00034 #endif
00035
00036
00037
00038 class EvaUtil{
00039 public:
00040 EvaUtil();
00041
00042 static char *doMd5(char *in, int len);
00043 static char *doMd5Md5(char *in, int len);
00044
00045 static std::string smileyToText(const char smileyCode);
00046 static char textToSmiley(const std::string &textTag);
00047 static int textToFileIndex(const std::string &textTag);
00048 static std::string fileIndexToText( const int fileIndex);
00049 static std::string convertToSend(const std::string &text);
00050 static std::string convertToSend(const std::string &text, bool *hasImage);
00051 static void initMap();
00052
00053 static std::string customSmileyToText(const char *buf, int *smileyLength, const char *uuid);
00054
00055 static void calcSuns(const unsigned short level, int *suns, int *moons, int *stars);
00056 typedef struct textMap{
00057
00058 char en[16];
00059 char py[16];
00060 } textMap;
00061
00062 static int write16(unsigned char *buf, const unsigned short value);
00063 static int write32(unsigned char *buf, const unsigned int value);
00064 static unsigned short read16(const unsigned char *buf);
00065 static unsigned int read32(const unsigned char *buf);
00066 private:
00067 static char md5Buf[KEY_LENGTH];
00068 static textMap map[QQ_SMILEY_AMOUNT];
00069 static const char smileyMap[QQ_SMILEY_AMOUNT];
00070 static int smileyToFileIndex( const char smileyCode);
00071
00072 };
00073
00074 #endif
00075