summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabberchatsession.h
blob: 52b6197a00b746930763218dc43d9300cd5a8e10 (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
/*
    jabbermessagemanager.h - Jabber Message Manager

    Copyright (c) 2004 by Till Gerken            <till@tantalo.net>

    Kopete    (c) 2004 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 JABBERCHATSESSION_H
#define JABBERCHATSESSION_H

#include "kopetechatsession.h"

#include "im.h"

class JabberProtocol;
class JabberAccount;
class JabberBaseContact;
namespace Kopete { class Message; }
class QString;


/**
 * @author Till Gerken
 */
class JabberChatSession : public Kopete::ChatSession
{
	Q_OBJECT

public:
	JabberChatSession ( JabberProtocol *protocol, const JabberBaseContact *user,
						   Kopete::ContactPtrList others, const TQString &resource = "",
						   const char *name = 0 );
	
	~JabberChatSession();
	
	/**
	 * @brief Get the local user in the session
	 * @return the local user in the session, same as account()->myself()
	 */
	const JabberBaseContact *user () const;

	/**
	 * @brief get the account
	 * @return the account
	 */
	JabberAccount *account() const ;

	/**
	 * @brief Return the resource this manager is currently associated with.
	 * @return currently associated resource
	 */
	const TQString &resource () const;

public slots:
	/**
	 * Show a message to the chatwindow, or append it to the queue.
	 * This is the function protocols HAVE TO call for both incoming and outgoing messages
	 * if the message must be showed in the chatwindow
	 *
	 * This is an overloaded version of the original implementation which
	 * also accepts a resource the message originates from. The message manager
	 * will set its own resource to the resource the message was received from.
	 * See @ref JabberBaseContact::manager() about how to deal with instantiating
	 * new message managers for messages not originating from the same resource
	 * a manager already exists for.
	 */
	void appendMessage ( Kopete::Message &msg, const TQString &fromResource );

private slots:
	void slotSendTypingNotification ( bool typing );
	void slotMessageSent ( Kopete::Message &message, Kopete::ChatSession *kmm );

	/**
	 * Re-generate the display name
	 */
	void slotUpdateDisplayName ();

	void slotSendFile();

private:
	/**
	 * Send a notification (XMPP::MsgEvent) to the members of the chatsession.
	 * SlotSendTypingNotification uses it.
	 */
	void sendNotification( XMPP::MsgEvent event );
	
	TQString mResource;
};

#endif

// vim: set noet ts=4 sts=4 tw=4: