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

List:       kopete-devel
Subject:    [Kopete-devel] IRC Notices
From:       "Tais M. Hansen" <tais.hansen () osd ! dk>
Date:       2003-05-09 12:58:26
[Download RAW message or body]

Hi,

Here's a patch to handle NOTICEs as private messages. I.e. messages from 
"nickserv" and "memoserv" are now received and shown as normal private 
messages.

-- 
Regards,
Tais M. Hansen
OSD

["kopete-irc-notice-patch" (text/x-diff)]

Index: protocols/irc/ircaccount.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/protocols/irc/ircaccount.cpp,v
retrieving revision 1.26
diff -u -4 -p -r1.26 ircaccount.cpp
--- protocols/irc/ircaccount.cpp	26 Apr 2003 18:27:19 -0000	1.26
+++ protocols/irc/ircaccount.cpp	9 May 2003 12:54:39 -0000
@@ -49,8 +49,9 @@ IRCAccount::IRCAccount(const QString &ac
 		mEngine->setPassword( getPassword() );
 
 	QObject::connect(mEngine, SIGNAL(successfullyChangedNick(const QString &, const \
QString &)), this, SLOT(successfullyChangedNick(const QString &, const QString &)));  \
QObject::connect(mEngine, SIGNAL(incomingPrivMessage(const QString &, const QString \
&, const QString &)), this, SLOT(slotNewPrivMessage(const QString &, const QString &, \
const QString &))); +	QObject::connect(mEngine, SIGNAL(incomingNotice(const QString \
&, const QString &)), this, SLOT(slotNotice(const QString &, const QString &)));  \
QObject::connect(mEngine, SIGNAL(connectedToServer()), this, \
SLOT(slotConnectedToServer()));  QObject::connect(mEngine, \
SIGNAL(connectionClosed()), this, SLOT(slotConnectionClosed()));  
 	mMySelf = findUser( mNickName );
@@ -302,7 +303,18 @@ void IRCAccount::slotJoinChannel()
 			findChannel( chan )->startChat();
 		else
 			KMessageBox::error(0l, i18n("<qt>\"%1\" is an invalid channel. Channels must \
start with '#'.</qt>").arg(chan), i18n("Kopete IRC Plugin"));  }
+}
+
+void IRCAccount::slotNotice( const QString &originating, const QString &message )
+{
+	kdDebug(14120) << k_funcinfo << "from " << originating << endl;
+	KopeteContactPtrList others;
+	others.append( myself() );
+	IRCUserContact *c = findUser( originating.section('!',0,0) );
+	KopeteMessage msg( (KopeteContact*)c, others, message, KopeteMessage::Inbound, \
KopeteMessage::PlainText, KopeteMessage::Chat ); +	msg.setBody( \
mProtocol->parser()->parse( msg.escapedBody() ), KopeteMessage::RichText ); \
+	c->manager()->appendMessage(msg);  }
 
 #include "ircaccount.moc"
Index: protocols/irc/ircaccount.h
===================================================================
RCS file: /home/kde/kdenonbeta/kopete/protocols/irc/ircaccount.h,v
retrieving revision 1.13
diff -u -4 -p -r1.13 ircaccount.h
--- protocols/irc/ircaccount.h	6 Apr 2003 19:22:35 -0000	1.13
+++ protocols/irc/ircaccount.h	9 May 2003 12:54:39 -0000
@@ -108,8 +108,9 @@ private slots:
 	void slotNewPrivMessage(const QString &originating, const QString &target, const \
QString &message);  void slotContactDestroyed(KopeteContact *);
 	void slotGoAway();
 	void slotJoinChannel();
+	void slotNotice(const QString &originating, const QString &message);
 
 private:
 	const IRCProtocol *mProtocol;
 	KopeteMessageManager *mManager;



_______________________________________________
Kopete-devel mailing list
Kopete-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kopete-devel


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

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