文档详情

QQ应用程序源代码.doc

发布:2017-11-25约2.11万字共10页下载文档
文本预览下载声明
QQ源代码?? //?MyQQ.cpp:?implementation?of?the?MyQQ?class.?//////////////////////////////////////////////////////////////////////?#include??#include?? #include?winsock2.h?? #include?MyQQ.h?#include?md5.h?? #ifdef?_DEBUG?#undef?THIS_FILE? static?char?THIS_FILE[]=__FILE__;?#define?new?DEBUG_NEW?#endif??? //////////////////////////////////////////////////////////////////////?//?Construction/Destruction? //////////////////////////////////////////////////////////////////////?MyQQ::MyQQ()?{? 牋牋?Ms?=?NULL;? 牋牋LoginToken?燦ULL;牋牋燣oginTokenLength??;牋牋燬tatus??;?////////////////下线?????IsLogin?=?false;?????LastID?=?0;? ????MessageText?=?NULL;?????FriendListHead?=?NULL;?????FriendListTail?=?NULL;? ????send_seq?=?random()??0x0000ffff;?????LastOnline?=?time(NULL);?????UDPServerNum?=?0;?????//服务器地址? ????LoginServer?=?(char?*)malloc(16*sizeof(char));?????//QQ号?????UserID?=?0;?????//密码? ????Password?=?NULL;?????? ????//得到初始化密钥,按2004版? InitKey?=?(unsigned?char*)malloc(QQ_KEY_LENGTH);? ????int?i;? ????for(i?=?0;?i??16;?i++)?????????InitKey?=?rand();? ????SessionKey?=?(unsigned?char*)malloc(QQ_KEY_LENGTH);?}?? MyQQ::~MyQQ()?{? 牋牋ssif(LoginServer?!=?NULL)?????????free(LoginServer);?????if(MyIP?!=?NULL)?????????free(MyIP);? 牋牋(Lif(MessageText?!=?NULL)?????????free(MessageText);?????if(Password?!=?NULL)?????????free(Password);?????if(InitKey?!=?NULL)?????????free(InitKey);?????if(PwdKey?!=?NULL)?????????free(PwdKey);? 牋牋(Mif(SessionKey?!=?NULL)?????????free(SessionKey);? 牋牋(Sif(FriendListHead?!=?NULL)?????{? 牋牋牋牋rienQQFriend?*p?=?FriendListHead-next;?????????while(p?!=?NULL)?????????{? 牋牋牋牋牋牋nd?*p?free(FriendListHead);?????????????FriendListHead?=?p;?????????????p?=?p-next;?????????}? 牋牋牋牋(Friif(FriendListTail?!=?NULL)?????????????free(FriendListTail);?????}?}?? void?MyQQ::Login(int?pMode)?{? 牋牋(Funsigned?char?*buf,?*cursor,?*raw_data,?*encrypted_data;?????int?seq_ret;? 牋牋siint?encrypted_len,?bytes;??????? 牋牋//en登录模式:1?为正常登录,2为隐身登录?,3登录即离开?????LoginMode?=?pMode;? ????? ????if(LoginToken?==?NULL
显示全部
相似文档