|
在 QQ2006 協議,ReceivedQunIMJoinRequest 包的回應數據比原來的多了兩項,現在補上對應新協議的類。
evaimreceive.h
[code:1]
class ReceivedQunIMJoinRequest2006{
public:
ReceivedQunIMJoinRequest2006(const unsigned char *buf, const int len);
ReceivedQunIMJoinRequest2006( const ReceivedQunIMJoinRequest2006 &rhs);
ReceivedQunIMJoinRequest2006() {};
const int getExtID() const { return externalID; }
const int getSender() const { return sender; }
const std::string &getMessage() const { return message; }
const char getType() const { return type; }
const int getCommander() const { return commander; }
ReceivedQunIMJoinRequest2006 &operator=(const ReceivedQunIMJoinRequest2006 &rhs);
private:
int externalID;
int sender;
unsigned char type;
std::string message;
int commander;
};
[/code:1]
evaimreceive.cpp
[code:1]
ReceivedQunIMJoinRequest2006::ReceivedQunIMJoinRequest2006( const unsigned char * buf, const int len)
{
int pos=0;
externalID = ntohl(*(int*)buf);
pos+=4;
type = buf[pos++];
sender = ntohl(*(int*)(buf+pos));
pos+=4;
if (QQ_CLIENT_VERSION>=0x0f00) {
// Unknown byte
pos++;
commander=ntohl(*(int*)(buf+pos));
pos+=4;
}
if(len == pos) {
message = "";
return;
}
unsigned length = (unsigned int)buf[pos++];
char *msg = (char *)malloc((length+1) * sizeof(char));
memcpy(msg, buf + pos, length);
msg[length] = 0x00;
message.assign(msg);
free(msg);
}
ReceivedQunIMJoinRequest2006::ReceivedQunIMJoinRequest2006( const ReceivedQunIMJoinRequest2006 & rhs )
{
*this = rhs;
}
ReceivedQunIMJoinRequest2006 & ReceivedQunIMJoinRequest2006::operator =( const ReceivedQunIMJoinRequest2006 & rhs )
{
externalID = rhs.getExtID();
sender = rhs.getSender();
type = rhs.getType();
message = rhs.getMessage();
commander = rhs.getCommander();
return *this;
}
[/code:1]
有一個1字節數據不明,第二個多了的是進行操作的管理員/群主QQ號 (用 getCommander() 取得)
另外...關於 QQ2006 協議尋找用戶的功能不知道云帆兄已經做好了沒有,不過我在這裡說一下我察覺到的情況及當然我使用的方法:
1. 如果是用數據來尋找符合條件的用戶,這種查詢會傳回暱稱,也就可以直接用
2. 如果是用QQ號來尋找用戶,這樣暱稱永遠會是字符串 "0",我當前的做法是查找後送出查找用戶信息的包來找出暱稱,然後在顯示在列表中。
到最後,請高手相助:
當前在調試 libeva 上使用 QQ2006 協議大致上沒什麼問題,只是有一個位置失效了,那就是臨時會話的發送功能。聽說 QQ2006 是要填上確認碼才能送出臨時會話的 (因為 QQ2006 沒繁體版本所以我沒法測試)
所以在這裡想請高手幫幫忙,截取傳送臨時會話的請求及回應包並把已解密的內容傳給我,我會為 libeva 做出對應的類。[/code] |
|