[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-31 4:12:38
Message-ID: 1156997558.595420.4236.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 579104 by blueangel:

Add the contactDetail support w/ codec support.
Next step: merge it into qqeditwidget.cpp.



 M  +3 -1      libeva.cpp  
 M  +41 -0     libeva.h  
 M  +23 -1     qqaccount.cpp  
 M  +4 -0      qqaccount.h  
 M  +8 -5      qqnotifysocket.cpp  
 M  +1 -0      qqnotifysocket.h  


--- trunk/KDE/kdenetwork/kopete/protocols/qq/libeva.cpp #579103:579104
@@ -30,10 +30,12 @@
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		0x00, 0x00, 0x00, 0x00 };
-	const uchar init_key[] = {
+	static const uchar init_key[] = {
 		0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
 		0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
 
+
+
 	const uchar* Packet::getInitKey() 
 	{
 		return init_key;
--- trunk/KDE/kdenetwork/kopete/protocols/qq/libeva.h #579103:579104
@@ -105,6 +105,47 @@
 	static const uint KeyLength = 16;
 	static const uint LoginLength = 416;
 
+	static const char* contactDetailIndex[] =
+	{
+		"qqID",
+		"nickName",
+		"country",
+		"state",
+		"zipcode",
+		"address",
+		"PHH", 
+		"age",
+		"gender",
+		"name",
+		"email",
+		"pagerSn",
+		"pagerNum",
+		"pagerSP",
+		"pagerBaseNum", 
+		"pagerType",	// what is the heck of these?
+		"occupation",
+		"homepage",
+		"authType",
+		"unknown1",
+		"unknown2",
+		"avatar",
+		"PHM",
+		"mobileType",
+		"intro",
+		"city",
+		"unknown3",
+		"unknown4",
+		"unknown5",
+		"openHP",
+		"openContact",
+		"college",
+		"horoscope",
+		"zodiac",
+		"bloodType",
+		"qqShow",
+		"unknown6"
+	};
+
 	// POD storage
 	struct ContactInfo {
 		uint id;
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqaccount.cpp #579103:579104
@@ -43,6 +43,7 @@
 	m_notifySocket = 0L;
 	m_connectstatus = QQProtocol::protocol()->Offline;
 	m_newContactList=false;
+	m_codec = QTextCodec::codecForName("GB18030");
  
 	// Init the myself contact
 	setMyself( new QQContact( this, accountId(), Kopete::ContactList::self()->myself() \
) ); @@ -52,6 +53,7 @@
 QString QQAccount::serverName()
 {
 	return configGroup()->readEntry(  "serverName" , "tcpconn3.tencent.com" );
+
 }
 
 uint QQAccount::serverPort()
@@ -122,6 +124,9 @@
 	QObject::connect( m_notifySocket, SIGNAL( messageReceived( const \
Eva::MessageHeader&, const Eva::ByteArray& ) ),  SLOT( slotMessageReceived( const \
Eva::MessageHeader&, const Eva::ByteArray& ) ) );  
+	QObject::connect( m_notifySocket, SIGNAL( contactDetailReceived( const QString&, \
const QList<QByteArray>& ) ), +		SLOT( slotContactDetailReceived( const QString&, \
const QList<QByteArray>& ) )); +
 	m_notifySocket->connect(host, port);
 }
 
@@ -265,7 +270,6 @@
 	// TODO: use guid for the conference
 	// TODO: use to for the conversation
 	// TODO: Add codec to the member variable, to improve the preformance.
-	QTextCodec* m_codec = QTextCodec::codecForName("GB18030");
 	QByteArray text = m_codec->fromUnicode( message.plainBody() );
 	notifySocket()->sendTextMessage(to, text );
 }
@@ -489,6 +493,24 @@
 }
 
 
+void QQAccount::slotContactDetailReceived( const QString& id, const \
QList<QByteArray>& list ) +{
+	// FIXME: update detail information for all contacts!
+	if( id != myself()->contactId() ) 
+		return;
 
+	// Open the configuration for update
+	KConfigGroup * config = configGroup();
+	for( int i = 1; i< \
sizeof(Eva::contactDetailIndex)/sizeof(Eva::contactDetailIndex[0]); i++ ) +	{
+		kDebug(14140) << k_funcinfo << i << endl;
+		if( 0 == strncmp( Eva::contactDetailIndex[i], "unknown", 7 ) )
+			continue;
 
+		config->writeEntry( QString(Eva::contactDetailIndex[i]), \
m_codec->toUnicode(list[i]) ); +	}
+
+}
+
+
 #include "qqaccount.moc"
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqaccount.h #579103:579104
@@ -41,6 +41,7 @@
 class QQProtocol;
 class QQNotifySocket;
 class QQChatSession;
+class QTextCodec;
 
 /**
  * This represents an account connected to the qq
@@ -115,6 +116,7 @@
 	void slotContactInGroup(const int qqId, const char type, const int groupId );
 	void slotContactStatusChanged(const Eva::ContactStatus& cs);
 	void slotMessageReceived( const Eva::MessageHeader& header, const Eva::ByteArray& \
message ); +	void slotContactDetailReceived( const QString& id, const \
QList<QByteArray>& list );   
 protected:
 	/**
@@ -163,6 +165,8 @@
 	uint m_clientId;
 
 	QList<QQChatSession*> m_chatSessions;
+
+	QTextCodec* m_codec;
 };
 
 #endif
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqnotifysocket.cpp #579103:579104
@@ -147,12 +147,15 @@
 		case Eva::ContactDetail :
 		{
 			std::list<std::string> list = Eva::Packet::contactDetail(text);
-			QStringList qsl;
-			for( std::list<std::string>::const_iterator it = list.begin(); 
-				it != list.end(); it++ )
-				qsl.push_back( QString((*it).c_str()) );
+			QList<QByteArray> qsl;
+			
+			std::list<std::string>::const_iterator it = list.begin(); 
+			QString id = QString( (*it).c_str() );
 
-			// emit Contact
+			for( ; it != list.end(); it++ )
+				qsl.push_back( QByteArray((*it).c_str()) );
+
+			emit contactDetailReceived(id, qsl);
 		}
 
 			
--- trunk/KDE/kdenetwork/kopete/protocols/qq/qqnotifysocket.h #579103:579104
@@ -72,6 +72,7 @@
 	void contactInGroup(const int qqId, const char type, const int groupId );
 	void contactStatusChanged( const Eva::ContactStatus& cs);
 	void messageReceived( const Eva::MessageHeader&, const Eva::ByteArray& );
+	void contactDetailReceived( const QString& id, const QList<QByteArray>& list );
 
 protected:
 	/**


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

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