summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/yahoo/yahooconferencemessagemanager.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/yahoo/yahooconferencemessagemanager.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/yahoo/yahooconferencemessagemanager.cpp')
-rw-r--r--kopete/protocols/yahoo/yahooconferencemessagemanager.cpp115
1 files changed, 115 insertions, 0 deletions
diff --git a/kopete/protocols/yahoo/yahooconferencemessagemanager.cpp b/kopete/protocols/yahoo/yahooconferencemessagemanager.cpp
new file mode 100644
index 00000000..cc173d96
--- /dev/null
+++ b/kopete/protocols/yahoo/yahooconferencemessagemanager.cpp
@@ -0,0 +1,115 @@
+/*
+ yahooconferencemessagemanager.h - Yahoo Conference Message Manager
+
+ Copyright (c) 2003 by Duncan Mac-Vicar <[email protected]>
+ Copyright (c) 2005 by AndrĂ© Duffeck <[email protected]>
+
+ Kopete (c) 2002-2005 by the Kopete developers <[email protected]>
+
+ *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ *************************************************************************
+*/
+
+#include <kdebug.h>
+#include <klineeditdlg.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpopupmenu.h>
+#include <kconfig.h>
+
+#include <kopetecontactaction.h>
+#include <kopetecontactlist.h>
+#include <kopetecontact.h>
+#include <kopetechatsessionmanager.h>
+#include <kopeteuiglobal.h>
+
+#include "yahooconferencemessagemanager.h"
+#include "yahoocontact.h"
+#include "yahooaccount.h"
+#include "yahooinvitelistimpl.h"
+
+YahooConferenceChatSession::YahooConferenceChatSession( const QString & yahooRoom, Kopete::Protocol *protocol, const Kopete::Contact *user,
+ Kopete::ContactPtrList others, const char *name )
+: Kopete::ChatSession( user, others, protocol, name )
+{
+
+ Kopete::ChatSessionManager::self()->registerChatSession( this );
+ setInstance(protocol->instance());
+
+ connect ( this, SIGNAL( messageSent ( Kopete::Message &, Kopete::ChatSession * ) ),
+ SLOT( slotMessageSent ( Kopete::Message &, Kopete::ChatSession * ) ) );
+
+ m_yahooRoom = yahooRoom;
+
+ m_actionInvite = new KAction( i18n( "&Invite others" ), "kontact_contacts", this, SLOT( slotInviteOthers() ), actionCollection(), "yahooInvite");
+
+ setXMLFile("yahooconferenceui.rc");
+}
+
+YahooConferenceChatSession::~YahooConferenceChatSession()
+{
+ emit leavingConference( this );
+}
+
+YahooAccount *YahooConferenceChatSession::account()
+{
+ return static_cast< YahooAccount *>( Kopete::ChatSession::account() );
+}
+
+const QString &YahooConferenceChatSession::room()
+{
+ return m_yahooRoom;
+}
+
+void YahooConferenceChatSession::joined( YahooContact *c )
+{
+ addContact( c );
+}
+
+void YahooConferenceChatSession::left( YahooContact *c )
+{
+ removeContact( c );
+}
+
+void YahooConferenceChatSession::slotMessageSent( Kopete::Message & message, Kopete::ChatSession * )
+{
+ kdDebug ( YAHOO_GEN_DEBUG ) << k_funcinfo << endl;
+
+ YahooAccount *acc = dynamic_cast< YahooAccount *>( account() );
+ if( acc )
+ acc->sendConfMessage( this, message );
+ appendMessage( message );
+ messageSucceeded();
+}
+
+void YahooConferenceChatSession::slotInviteOthers()
+{
+ QStringList buddies;
+ QDictIterator<Kopete::Contact> it( account()->contacts() );
+ Kopete::Contact *myself = account()->myself();
+ for( ; it.current(); ++it )
+ {
+ if( (*it) != myself && !members().contains( *it ) )
+ buddies.push_back( (*it)->contactId() );
+ }
+
+ YahooInviteListImpl *dlg = new YahooInviteListImpl( Kopete::UI::Global::mainWidget() );
+ QObject::connect( dlg, SIGNAL( readyToInvite( const QString &, const QStringList &, const QStringList &, const QString & ) ),
+ account(), SLOT( slotAddInviteConference( const QString &, const QStringList &, const QStringList &, const QString & ) ) );
+ dlg->setRoom( m_yahooRoom );
+ dlg->fillFriendList( buddies );
+ for( QPtrList<Kopete::Contact>::ConstIterator it = members().begin(); it != members().end(); it++ )
+ dlg->addParticipant( (*it)->contactId() );
+ dlg->show();
+}
+
+#include "yahooconferencemessagemanager.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
+