Bug 74234

Summary: Update the authorization request setting on the server automatically
Product: [Unmaintained] kopete Reporter: palantir
Component: ICQ and AIM PluginsAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description palantir 2004-02-05 14:39:00 UTC
Version:           0.8.90 (CVS >= 20040123) (using KDE 3.2.90 (CVS >= 20040117), Gentoo)
Compiler:          gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)
OS:          Linux (i686) release 2.4.20-gentoo-r6

Even when the appropriate box is checked in the ICQ configuration, people using ICQ can add you to their list without authorization. I have tried to change this setting and it worked twice, while it didn't work the other ten times...
Comment 1 Stefan Gehn 2004-02-05 14:56:16 UTC
The auth system in icq can be tricked without any problems, the checkbox is just there because every icq client supports it (though almost all clients allow chatting to others without being authorized by them).
Comment 2 palantir 2004-02-05 15:06:56 UTC
So if it is NOT working and is not supposed to work, do remove it! Or, if it is there, repair it, but it doesn't make sense IMVHO to have an option there which sometimes works and some others doesn't. 
Comment 3 Marcelo Penna Guerra 2004-02-05 16:17:36 UTC
Well, it does work, but it's not very intuitive. The setting you choose is changed on the server when you change your details on it. So, retrieve your details from the server, mark the option you want (need auth or not) and send your details back to the server. This behavior should be changed so this setting is changed when you press "OK", or the option should be moved to the contact details tab.
Comment 4 Matt Rogers 2004-03-04 19:38:45 UTC
you're responsible for sending your user info back to the server, and it does work when you do it. Changing to a wishlist to add support for sending authorization setting automatically.
Comment 5 Matt Rogers 2004-03-04 19:39:11 UTC
gah, not invalid
Comment 6 Roman Jarosz 2006-11-04 15:23:29 UTC
SVN commit 601881 by rjarosz:

Implement "Requires auth" option and update "Requires auth" and "Web Aware" settings on the server automatically.

FEATURE: 71660
FEATURE: 74234



 M  +16 -2     icq/icqaccount.cpp  
 M  +17 -0     icq/ui/icqeditaccountwidget.cpp  
 M  +23 -9     liboscar/icquserinfo.cpp  
 M  +5 -3      liboscar/icquserinfo.h  


--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/icqaccount.cpp #601880:601881
@@ -59,11 +59,25 @@
 	if ( Oscar::normalize( contact ) != Oscar::normalize( contactId() ) )
 		return;
 
-	ICQShortInfo shortInfo = static_cast<ICQAccount*>( account() )->engine()->getShortInfo( contact );
+	ICQAccount* icqAccount = static_cast<ICQAccount*>( account() );
+	ICQShortInfo shortInfo = icqAccount->engine()->getShortInfo( contact );
 	if ( !shortInfo.nickname.isEmpty() )
 	{
-		setProperty( Kopete::Global::Properties::self()->nickName(), static_cast<ICQAccount*>( account() )->defaultCodec()->toUnicode( shortInfo.nickname ) );
+		setProperty( Kopete::Global::Properties::self()->nickName(), icqAccount->defaultCodec()->toUnicode( shortInfo.nickname ) );
 	}
+
+	//Sync server settings with local
+	QList<ICQInfoBase*> infoList;
+
+	ICQShortInfo* info = new ICQShortInfo( shortInfo );
+
+	Oscar::Settings* oscarSettings = icqAccount->engine()->clientSettings();
+	info->needsAuth.set( oscarSettings->requireAuth() );
+	info->webAware.set( oscarSettings->webAware() );
+
+	infoList.append( info );
+	if ( !icqAccount->engine()->updateProfile( infoList ) )
+		qDeleteAll( infoList );
 }
 
 void ICQMyselfContact::fetchShortInfo()
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/icq/ui/icqeditaccountwidget.cpp #601880:601881
@@ -41,6 +41,7 @@
 #include "icqaccount.h"
 #include "icqcontact.h"
 #include "oscarprivacyengine.h"
+#include "oscarsettings.h"
 
 ICQEditAccountWidget::ICQEditAccountWidget(ICQProtocol *protocol,
 	Kopete::Account *account, QWidget *parent)
@@ -180,17 +181,23 @@
 	mAccountSettings->mPasswordWidget->save(&mAccount->password());
 	mAccount->setExcludeConnect(mAccountSettings->chkAutoLogin->isChecked());
 
+	Oscar::Settings* oscarSettings = mAccount->engine()->clientSettings();
+
 	bool configChecked = mAccountSettings->chkRequireAuth->isChecked();
 	mAccount->configGroup()->writeEntry( "RequireAuth", configChecked );
+	oscarSettings->setRequireAuth( configChecked );
 
 	configChecked = mAccountSettings->chkRespectRequireAuth->isChecked();
 	mAccount->configGroup()->writeEntry( "RespectRequireAuth", configChecked );
+	oscarSettings->setRespectRequireAuth( configChecked );
 
 	configChecked = mAccountSettings->chkHideIP->isChecked();
 	mAccount->configGroup()->writeEntry( "HideIP", configChecked );
+	oscarSettings->setHideIP( configChecked );
 
 	configChecked = mAccountSettings->chkWebAware->isChecked();
 	mAccount->configGroup()->writeEntry( "WebAware", configChecked );
+	oscarSettings->setWebAware( configChecked );
 
 	int configValue = mProtocol->getCodeForCombo( mAccountSettings->encodingCombo,
                                                   mProtocol->encodings() );
@@ -210,12 +217,19 @@
 	//set filetransfer stuff
 	configChecked = mAccountSettings->chkFileProxy->isChecked();
 	mAccount->configGroup()->writeEntry( "FileProxy", configChecked );
+	oscarSettings->setFileProxy( configChecked );
+
 	configValue = mAccountSettings->sbxFirstPort->value();
 	mAccount->configGroup()->writeEntry( "FirstPort", configValue );
+	oscarSettings->setFirstPort( configValue );
+
 	configValue = mAccountSettings->sbxLastPort->value();
 	mAccount->configGroup()->writeEntry( "LastPort", configValue );
+	oscarSettings->setLastPort( configValue );
+
 	configValue = mAccountSettings->sbxTimeout->value();
 	mAccount->configGroup()->writeEntry( "Timeout", configValue );
+	oscarSettings->setTimeout( configValue );
 
 	// Global Identity
 	mAccount->configGroup()->writeEntry( "ExcludeGlobalIdentity", mAccountSettings->chkGlobalIdentity->isChecked() );
@@ -230,6 +244,9 @@
 		
 		if ( m_ignoreEngine )
 			m_ignoreEngine->storeChanges();
+
+		//Update Oscar settings
+		static_cast<ICQMyselfContact*>( mAccount->myself() )->fetchShortInfo();
 	}
 	
 	return mAccount;
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/icquserinfo.cpp #601880:601881
@@ -25,8 +25,8 @@
 ICQShortInfo::ICQShortInfo()
 {
 	uin = 0;
-	needsAuth = false;
-	gender = 0;
+	needsAuth.init( false );
+	webAware.init( false );
 }
 
 void ICQShortInfo::fill( Buffer* buffer )
@@ -38,14 +38,27 @@
 		firstName = buffer->getLELNTS();
 		lastName = buffer->getLELNTS();
 		email = buffer->getLELNTS();
-		needsAuth = buffer->getByte();
-		buffer->skipBytes( 1 ); //skip the unknown byte
-		gender = buffer->getByte();
+		needsAuth = ( buffer->getByte() == 0x00 );
+		webAware = ( buffer->getByte() != 0x02 );
+// 		gender = buffer->getByte();
 	}
 	else
 		kDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Couldn't parse ICQ short user info packet" << endl;
 }
 
+void ICQShortInfo::store( Buffer* buffer )
+{
+	if ( needsAuth.hasChanged() )
+	{
+		buffer->addLETLV8( 0x02F8, ( needsAuth.get() ) ? 0x00 : 0x01 );
+	}
+
+	if ( webAware.hasChanged() )
+	{
+		buffer->addLETLV8( 0x030C, ( webAware.get() ) ? 0x01 : 0x00 );
+	}
+}
+
 ICQGeneralUserInfo::ICQGeneralUserInfo()
 {
 	uin.init( 0 );
@@ -54,6 +67,7 @@
 	publishEmail.init( false );
 	webAware.init( false );
 	allowsDC.init( false );
+	needsAuth.init( false );
 }
 
 void ICQGeneralUserInfo::fill( Buffer* buffer )
@@ -74,7 +88,7 @@
 		zip = buffer->getLELNTS();
 		country = buffer->getLEWord();
 		timezone = buffer->getLEByte(); // UTC+(tzcode * 30min)
-		authorization = ( buffer->getByte() == 0x00 );
+		needsAuth = ( buffer->getByte() == 0x00 );
 		webAware = ( buffer->getByte() == 0x01 );
 		allowsDC = ( buffer->getByte() == 0x01 ); //taken from sim
 		publishEmail = ( buffer->getByte() == 0x01 );
@@ -162,11 +176,11 @@
 	}
 	if ( webAware.hasChanged() )
 	{
-		buffer->addLETLV8( 0x02F8, ( webAware.get() ) ? 0x01 : 0x00 );
+		buffer->addLETLV8( 0x030C, ( webAware.get() ) ? 0x01 : 0x00 );
 	}
-	if ( authorization.hasChanged() )
+	if ( needsAuth.hasChanged() )
 	{
-		buffer->addLETLV8( 0x030C, ( authorization.get() ) ? 0x00 : 0x01 );
+		buffer->addLETLV8( 0x02F8, ( needsAuth.get() ) ? 0x00 : 0x01 );
 	}
 }
 
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/icquserinfo.h #601880:601881
@@ -56,6 +56,7 @@
 	ICQShortInfo();
 	~ICQShortInfo() {}
 	void fill( Buffer* buffer );
+	void store( Buffer* buffer );
 	
 public:
 	unsigned long uin;
@@ -63,8 +64,9 @@
 	QByteArray firstName;
 	QByteArray lastName;
 	QByteArray email;
-	bool needsAuth;
-	unsigned int gender; // 0=offline, 1=online, 2=not webaware
+	ICQInfoValue<bool> needsAuth;
+	ICQInfoValue<bool> webAware; // 0=offline, 1=online, 2=not webaware
+// 	unsigned int gender;
 };
 
 class KOPETE_EXPORT ICQGeneralUserInfo : public ICQInfoBase
@@ -93,7 +95,7 @@
 	ICQInfoValue<bool> publishEmail;
 	ICQInfoValue<bool> allowsDC;
 	ICQInfoValue<bool> webAware;
-	ICQInfoValue<bool> authorization;
+	ICQInfoValue<bool> needsAuth;
 };
 
 class KOPETE_EXPORT ICQWorkUserInfo : public ICQInfoBase