[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/qq
From:       Hui Jin <blueangel.jin () gmail ! com>
Date:       2006-08-26 4:00:58
Message-ID: 1156564858.142620.1259.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 577286 by blueangel:

Rename CGT to  GroupInfo
Rename cgts to groupInfos
Add contactDetail skeleton.
Rename userInfo to contactInfo, but still using UserInfo as the command. Shall we use \
Eva::Command::ContactInfo instead?



 M  +16 -7     libeva.cpp  
 M  +9 -8      libeva.h  
 M  +13 -13    qqnotifysocket.cpp  
 M  +2 -1      qqnotifysocket.h  


--- trunk/KDE/kdenetwork/kopete/protocols/qq/libeva.cpp #577285:577286
@@ -173,14 +173,14 @@
 		return list;
 	}
 
-	std::list< CGT > Packet::cgts( const ByteArray& text )
+	std::list< GroupInfo > Packet::groupInfos( const ByteArray& text )
 	{
 		int offset = 10;
-		std::list< CGT > list;
+		std::list< GroupInfo > list;
 		while( offset < text.size() )
 		{
 			list.push_back( 
-				CGT( ntohl( type_cast<int>( text.data()+offset ) ), 
+				GroupInfo( ntohl( type_cast<int>( text.data()+offset ) ), 
 				type_cast<char>(text.data()+offset+4), ( type_cast<short>(text.data()+5) >> 2) & \
0x3f ) );  offset += 6;
 		}
@@ -201,7 +201,16 @@
 		}
 		return list;
 	}
-					
+
+	std::list< std::string > contactDetail( const ByteArray& text )
+	{
+		char* start = text.c_str();
+		std::list< std::string > list;
+		// TODO: convert to string. use split.
+		return list;
+	}
+				
+
 			
 	// Core functions
 	ByteArray loginToken( uint id, ushort sequence )
@@ -272,10 +281,10 @@
 		return Packet::create(id, ChangeStatus, sequence, key, text );
 	}
 
-	ByteArray userInfo( uint id, ushort sequence, const ByteArray& key, int qqId )
+	ByteArray contactInfo( uint id, ushort sequence, const ByteArray& key, int qqId )
 	{
-		ByteArray text(20);
-		snprintf( text.c_str(), 19, "%d", qqId );
+		ByteArray text(32);
+		snprintf( text.c_str(), 31, "%d", qqId );
 		text.setSize( strlen( text.c_str() ) );
 		return Packet::create(id, UserInfo, sequence, key, text );
 	}
--- trunk/KDE/kdenetwork/kopete/protocols/qq/libeva.h #577285:577286
@@ -114,13 +114,13 @@
 		std::string nick;
 	};
 
-	// Contact-Group-Trio
-	struct CGT { 
-		int qqId;
-		char type;
-		char groupId;
+	// GroupInfo
+	struct GroupInfo { 
+		uint qqId;
+		uchar type;
+		uchar groupId;
 
-		CGT( int q, char t, char g ) : qqId(q), type (t), groupId(g) {};
+		GroupInfo( uint q, uchar t, uchar g ) : qqId(q), type (t), groupId(g) {};
 	};
 
 
@@ -391,8 +391,9 @@
 		static std::list< std::string > groupNames(const ByteArray& text );
 		// FIXME: use list as others
 		ContactInfo contactInfo( char* buffer, int& len );
-		static std::list< CGT > cgts( const ByteArray& text );
+		static std::list< GroupInfo > groupInfos( const ByteArray& text );
 		static std::list< ContactStatus > onlineContacts( const ByteArray& text, uchar& \
pos ); +		static std::list< std::string > contactDetail( const ByteArray& text );
 
 	private:
 		ushort m_version;
@@ -416,7 +417,7 @@
 	/** 
 	 * Fetch user information of qqId
 	 */
-	ByteArray userInfo( uint id, ushort sequence, const ByteArray& key, int qqId );
+	ByteArray contactInfo( uint id, ushort sequence, const ByteArray& key, int qqId );
 	/**
 	 * request transfer key, which is used as the identification of the conversation
 	 */
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqnotifysocket.cpp #577285:577286
@@ -266,15 +266,21 @@
 					if( !m_heartbeat->isActive() )
 						m_heartbeat->start(60000, false);
 
+					// FIXME: refactor me!
 					emit newContactList();
 					// FIXME: We might login in as invisible as well.
 					m_newstatus = Kopete::OnlineStatus::Online;
 					sendPacket( Eva::statusUpdate( m_qqId, m_id++, m_sessionKey, Eva::Online) );
 					sendPacket( Eva::transferKey( m_qqId, m_id++, m_sessionKey) );
 
+					// get the meta data for myself
+					contactInfo(m_qqId);
+
 					// fetch the online contacts
 					sendListOnlineContacts();
 
+
+
 					break;
 
 				case Eva::LoginRedirect :
@@ -328,7 +334,7 @@
 		case Eva::Memo :
 			break;
 		case Eva::DownloadGroups :
-			doGetCGTs( text );
+			groupInfos( text );
 			break;
 
 		case Eva::GetLevel :
@@ -360,18 +366,12 @@
 	}
 }
 
-// FIXME: Refactor us !!
 
-/*
-void QQNotifySocket::sendUserInfo(Eva::uint qqId)
+void QQNotifySocket::contactInfo(Eva::uint qqId)
 {
-	Eva::ByteArray packet = Eva::userInfo( m_qqId, m_id++, m_sessionKey, qqId);
-	sendPacket( QByteArray( packet.c_str(), packet.size()) );
+	sendPacket( Eva::contactInfo( m_qqId, m_id++, m_sessionKey, qqId) );
 }
 	
-*/
-
-
 void QQNotifySocket::sendTextMessage( const uint toId, const QByteArray& message )
 {
 	// Translate the message to Eva::ByteArray
@@ -408,13 +408,13 @@
 	emit groupNames( ql );
 }
 
-void QQNotifySocket::doGetCGTs( const Eva::ByteArray& text )
+void QQNotifySocket::groupInfos( const Eva::ByteArray& text )
 {
 	kDebug(14140) << k_funcinfo << endl;
-	std::list< Eva::CGT > cgts = Eva::Packet::cgts( text );
+	std::list< Eva::GroupInfo > gis = Eva::Packet::groupInfos( text );
 	// TODO: send it one by one.
-	for( std::list< Eva::CGT >::const_iterator it = cgts.begin();
-		it != cgts.end(); it++ )
+	for( std::list< Eva::GroupInfo >::const_iterator it = gis.begin();
+		it != gis.end(); it++ )
 	{
 		kDebug(14140) << "buddy: qqId = " << (*it).qqId << " type = " << (*it).type 
 			<< " groupId = " << (*it).groupId << endl;
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqnotifysocket.h #577285:577286
@@ -100,11 +100,12 @@
 	{ QQSocket::sendPacket( QByteArray(packet.c_str(), packet.size() ) ); }
 
 	void groupNames( const Eva::ByteArray& text );
-	void doGetCGTs( const Eva::ByteArray& text );
+	void groupInfos( const Eva::ByteArray& text );
 	void doGetContactStatuses( const Eva::ByteArray& text );
 	void sendListOnlineContacts(uint pos = 0);
 	void sendMsgReply( int sequence, const Eva::ByteArray& replyKey );
 	void heartbeat();
+	void contactInfo(Eva::uint qqId);
 
 private:
 	QQAccount *m_account;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic