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

List:       kde-commits
Subject:    branches/KDE/3.4/kdenetwork/kopete/protocols/irc
From:       Tommi Rantala <tommi.rantala () cs ! helsinki ! fi>
Date:       2005-08-10 14:59:05
Message-ID: 1123685945.935977.30272.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 445143 by rantala:

BUG: 104920

backport revision 410353:

Modify IRCContactManager to use account->networkName() instead of
account->engine()->currentHost() as the 'nick name' for server contacts.

This nick name is eventually used by Kopete::Account::registerContact()
and causes problems because currentHost() returns null string before the
account is connected to a server.

Notes:
- I had to add two new parameters to IRCAccount (networkName & nickName),
  because the contacts are created when the account is constructed. So calling
  account->setNickName() etc. in editaccountwidget is not enough.
- Gets rid of "QGDict::hashKeyString: Invalid null key" when accounts are
  created at startup, and when they are deleted (that was caused by
  currentHost()).
- Fix crashing after creating a new IRC account and quitting right after
  that (at least I'm experiencing this with 0.10 & SVN).



 M  +11 -3     ircaccount.cpp  
 M  +2 -1      ircaccount.h  
 M  +1 -1      irccontactmanager.cpp  
 M  +6 -3      ui/irceditaccountwidget.cpp  


--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/ircaccount.cpp #445142:445143
@@ -93,7 +93,7 @@
 const QString IRCAccount::CONFIG_USERNAME = QString::fromLatin1("UserName");
 const QString IRCAccount::CONFIG_REALNAME = QString::fromLatin1("RealName");
 
-IRCAccount::IRCAccount(IRCProtocol *protocol, const QString &accountId, const \
QString &autoChan ) +IRCAccount::IRCAccount(IRCProtocol *protocol, const QString \
&accountId, const QString &autoChan, const QString& netName, const QString &nickName) \
: Kopete::PasswordedAccount(protocol, accountId, 0, true), autoConnect( autoChan )  {
 	m_manager = 0L;
@@ -146,8 +146,16 @@
 	currentHost = 0;
 
 	KConfigGroup *config = configGroup();
-	QString networkName = config->readEntry(CONFIG_NETWORKNAME);
-	mNickName = config->readEntry(CONFIG_NICKNAME);
+
+	QString networkName = netName;
+	if (networkName.isNull())
+		networkName = config->readEntry(CONFIG_NETWORKNAME);
+
+	if (!nickName.isNull())
+		setNickName(nickName);
+	else
+		mNickName = config->readEntry(CONFIG_NICKNAME);
+
 	QString codecMib = config->readEntry(CONFIG_CODECMIB);
 	//	int codecMib = config->readNumEntry(CONFIG_CODECMIB, UTF-8);
 
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/ircaccount.h #445142:445143
@@ -118,7 +118,8 @@
 		Ignore = 5
 	};
 
-	IRCAccount(IRCProtocol *p, const QString &accountid, const QString &autoConnect = \
QString::null); +	IRCAccount(IRCProtocol *p, const QString &accountid, const QString \
&autoConnect = QString::null, +			const QString& networkName = QString::null, const \
QString &nickName = QString::null);  ~IRCAccount();
 
 	void setNickName( const QString & );
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/irccontactmanager.cpp \
#445142:445143 @@ -46,7 +46,7 @@
 
 	Kopete::MetaContact *m = new Kopete::MetaContact();
 //	m->setTemporary( true );
-	m_myServer = new IRCServerContact(this, account->engine()->currentHost(), m);
+	m_myServer = new IRCServerContact(this, account->networkName(), m);
 
 	QObject::connect(account->engine(), SIGNAL(incomingMessage(const QString &, const \
QString &, const QString &)),  this, SLOT(slotNewMessage(const QString &, const \
                QString &, const QString &)));
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/ui/irceditaccountwidget.cpp \
#445142:445143 @@ -230,17 +230,20 @@
 
 	if( !account() )
 	{
-		setAccount( new IRCAccount( mProtocol, generateAccountId(networkName) ) );
+		setAccount( new IRCAccount( mProtocol, generateAccountId(networkName), \
QString::null, networkName, nickName ) );  
 	}
+	else
+	{
+		account()->setNickName( nickName );
+		account()->setNetwork( networkName );
+	}
 
 	mPasswordWidget->save( &account()->password() );
 
-	account()->setNickName( nickName );
 	account()->setAltNick( mAltNickname->text() );
 	account()->setUserName( mUserName->text() );
 	account()->setRealName( m_realNameLineEdit->text() );
-	account()->setNetwork( networkName );
 	account()->setDefaultPart( partMessage->text() );
 	account()->setDefaultQuit( quitMessage->text() );
 	account()->setAutoShowServerWindow( autoShowServerWindow->isChecked() );


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

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