3
* Ekiga -- A VoIP and Video-Conferencing application
4
* Copyright (C) 2000-2007 Damien Sandras
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or (at
9
* your option) any later version. This program is distributed in the hope
10
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
11
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Ekiga is licensed under the GPL license and as a special exception, you
19
* have permission to link or otherwise combine this program with the
20
* programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
21
* applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
22
* programs, as long as you do follow the requirements of the GNU GPL for all
23
* the rest of the software thus combined.
28
* chat.h - description
29
* ------------------------------------------
30
* begin : written in 2007 by Julien Puydt
31
* copyright : (c) 2007 by Julien Puydt
32
* description : declaration of the interface of a chat
40
#include <sigc++/sigc++.h>
42
#include "chain-of-responsibility.h"
43
#include "form-request.h"
44
#include "menu-builder.h"
52
virtual ~ChatObserver () {}
54
/** Tell the observer about a new user message, like :
55
* observer.message ("Damien", "Hi Snark, did you fix bug #314159 ?");
58
virtual void message (const std::string to,
59
const std::string msg) = 0;
61
/** Tell the observer about a new service message, like :
62
* observer.notice ("Snark just disconnected");
65
virtual void notice (const std::string msg) = 0;
78
/** Returns the title of the Chat.
79
* @return The chat title.
81
virtual const std::string get_title () const = 0;
83
/** Connects a new observer to the Chat ; notice that using an
84
* observer-as-an-object approch vs a signal based approch makes
85
* it possible to detect when the last observer quits, and hence
86
* quit the Chat (emit "removed"). The Chat can use that call to
87
* send a few previous messages to the new observer.
88
* @param The new observer
90
virtual void connect (ChatObserver &observer) = 0;
92
/** Disconnects the new observer from the Chat
93
* @param The observer to disconnect
95
virtual void disconnect (ChatObserver &observer) = 0;
97
/** Sends a message through the Chat, or at least attempts to :
98
* the two ideas are first that the text entry will get blanked
99
* only if true is returned, and second that true doesn't mean the
100
* message is really sent, but only that it was valid to try (for
101
* example, the Chat will return false if you try to send when not
102
* having "voice" on an irc channel, or if you try to send to a
103
* disconnected contact with a protocol which doesn't support
104
* disconnected operation). The user may still be warned that the
105
* actual sending was impossible later through a notice message.
106
* @param The message to send
107
* @return True if it was valid to send a message
109
virtual bool send_message (const std::string msg) = 0;
111
/** This signal is emitted when the Chat has been updated.
113
sigc::signal<void> updated;
115
/** This signal is emitted when the user requested to see this Chat
117
sigc::signal<void> user_requested;
119
/** This signal is emitted when the Chat has been removed.
121
sigc::signal<void> removed;
123
/** Feed possible actions on this Chat to the given MenuBuilder
124
* @param A MenuBuilder object to populate.
126
virtual bool populate_menu (MenuBuilder &) = 0;
128
/** This chain allows the Chat to present forms to the user.
130
ChainOfResponsibility<FormRequest*> questions;