summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabbergroupcontact.h
blob: 7cbd4f366191a7049189dac1ab48c386e536b3f2 (plain)
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
 /*
  * jabbercontact.cpp  -  Kopete Jabber protocol groupchat contact
  *
  * Copyright (c) 2002-2004 by Till Gerken <till@tantalo.net>
  *
  * Kopete    (c) 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.                                   *
  * *                                                                       *
  * *************************************************************************
  */

#ifndef JABBERGROUPCONTACT_H
#define JABBERGROUPCONTACT_H

#include "jabberbasecontact.h"

namespace Kopete { class MetaContact; }
class JabberGroupChatManager;

class JabberGroupContact : public JabberBaseContact
{

Q_OBJECT

public:

	JabberGroupContact (const XMPP::RosterItem &rosterItem,
						JabberAccount *account, Kopete::MetaContact * mc);

	~JabberGroupContact ();

	/**
	 * Create custom context menu items for the contact
	 * FIXME: implement manager version here?
	 */
	TQPtrList<KAction> *customContextMenuActions ();

	/**
	 * Deal with an incoming message for this contact.
	 */
	void handleIncomingMessage ( const XMPP::Message &message );

	/**
	 * Add a contact to this room.
	 */
	JabberBaseContact *addSubContact ( const XMPP::RosterItem &rosterItem, bool addToManager = true );

	/**
	 * Remove a contact from this room.
	 */
	void removeSubContact ( const XMPP::RosterItem &rosterItem );

	Kopete::ChatSession *manager ( Kopete::Contact::CanCreateFlags canCreate = Kopete::Contact::CannotCreate );

public slots:

	/**
	 * This is the JabberContact level slot for sending files.
	 *
	 * @param sourceURL The actual KURL of the file you are sending
	 * @param fileName (Optional) An alternate name for the file - what the
	 *                 receiver will see
	 * @param fileSize (Optional) Size of the file being sent. Used when sending
	 *                 a nondeterminate file size (such as over a socket)
	 */
	virtual void sendFile( const KURL &sourceURL = KURL(),
		const TQString &fileName = TQString::null, uint fileSize = 0L );

private slots:

	/**
	 * Catch a dying message manager and leave the room.
	 */
	void slotChatSessionDeleted ();
	
	/**
	 * When our own status change, we need to manually send the presence.
	 */
	void slotStatusChanged();
	
	/**
	 * ask the user to change the nick, and change it
	 */
	void slotChangeNick();
	
	/**
	 * a subcontact has been destroyed   (may happen when closing kopete)
	 */
	void slotSubContactDestroyed(Kopete::Contact*);

private:

	TQPtrList<Kopete::Contact> mContactList;
	TQPtrList<Kopete::MetaContact> mMetaContactList;

	JabberGroupChatManager *mManager;
	JabberBaseContact *mSelfContact;
	TQString mNick;
};

#endif