Bug 71660 - Fully implement "Requires auth" option in ICQ
Summary: Fully implement "Requires auth" option in ICQ
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: ICQ and AIM Plugins (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 71659 124443 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-02 10:40 UTC by Casey Allen Shobe
Modified: 2006-11-04 15:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casey Allen Shobe 2004-01-02 10:40:13 UTC
Version:            (using KDE Devel)

I have a fairly new ICQ account that apparently requires auth by default.  The checkbox in Kopete's account configuration for this shows up as unchecked, when indeed the contact does require authorization from what I can tell using ICQlite.
Comment 1 Matt Rogers 2004-01-02 16:34:38 UTC
I can't know if the account requires authorization when you first add the account, but I imagine that i can after the initial setup and first connection. 
Comment 2 Casey Allen Shobe 2004-01-03 02:40:55 UTC
mattr: Precisely.  In fact, this field (and maybe others) should maybe be disabled until some info can be fetched from the server (maybe the Edit Account dialog can have a button to "Verify Information" which would A> check your login credentials (prompting for a password if needed), and B> fetch info from the server, then immediately disconnect, updating and enabling additional options like this (of course, this button would be disabled for accounts that you had already signed on with).
Comment 3 Matt Rogers 2004-01-03 05:56:45 UTC
Actually, when you're first setting up the account, the purpose of having the checkbox there is to tell the icq plugin that your account will require authorization so that it sets the proper flag on the ICQ server.  However the verify information deal sounds interesting, i'll keep it in mind.

Maybe I can pull some ideas from the official ICQ client on how they handle it.
Comment 4 Matt Rogers 2004-01-13 08:01:21 UTC
post 3.2/0.8
Comment 5 Stefan Gehn 2004-01-23 21:03:33 UTC
There is no packet to get the auth setting off the server so all we can do is send it on every connect and risk overriding the setting done by another client.
Comment 6 Stefan Gehn 2004-02-12 12:55:04 UTC
I'll remove the checkbox altogether soon and it'll only come back if there's an usable way to find out if we authorized another user to message us. If it turns out that there's no reliable way in finding out if he's authorized or not we have to live without this option.
I'll make this bug "UNCONFIRMED" until somebody finds out if the above is possible in ICQ (currently I don't see a way to do that).
Comment 7 Matt Rogers 2004-07-11 21:02:51 UTC
*** Bug 71659 has been marked as a duplicate of this bug. ***
Comment 8 Dirk Stoecker 2006-08-02 10:33:50 UTC
*** Bug 124443 has been marked as a duplicate of this bug. ***
Comment 9 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