1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
yahooconferencemessagemanager.h - Yahoo Conference Message Manager
Copyright (c) 2003 by Duncan Mac-Vicar <duncan@kde.org>
Copyright (c) 2005 by André Duffeck <andre@duffeck.de>
Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* 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 <tdeconfig.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 TQString & 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, TQT_SIGNAL( messageSent ( Kopete::Message &, Kopete::ChatSession * ) ),
TQT_SLOT( slotMessageSent ( Kopete::Message &, Kopete::ChatSession * ) ) );
m_yahooRoom = yahooRoom;
m_actionInvite = new TDEAction( i18n( "&Invite others" ), "kontact_contacts", this, TQT_SLOT( slotInviteOthers() ), actionCollection(), "yahooInvite");
setXMLFile("yahooconferenceui.rc");
}
YahooConferenceChatSession::~YahooConferenceChatSession()
{
emit leavingConference( this );
}
YahooAccount *YahooConferenceChatSession::account()
{
return static_cast< YahooAccount *>( Kopete::ChatSession::account() );
}
const TQString &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()
{
TQStringList buddies;
TQDictIterator<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() );
TQObject::connect( dlg, TQT_SIGNAL( readyToInvite( const TQString &, const TQStringList &, const TQStringList &, const TQString & ) ),
account(), TQT_SLOT( slotAddInviteConference( const TQString &, const TQStringList &, const TQStringList &, const TQString & ) ) );
dlg->setRoom( m_yahooRoom );
dlg->fillFriendList( buddies );
for( TQPtrList<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:
|