~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/engine/chat/skel/chat.h

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/*
3
 
 * Ekiga -- A VoIP and Video-Conferencing application
4
 
 * Copyright (C) 2000-2007 Damien Sandras
5
 
 
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.
13
 
 *
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.
17
 
 *
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.
24
 
 */
25
 
 
26
 
 
27
 
/*
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
33
 
 *
34
 
 */
35
 
 
36
 
#ifndef __CHAT_H__
37
 
#define __CHAT_H__
38
 
 
39
 
#include <string>
40
 
#include <sigc++/sigc++.h>
41
 
 
42
 
#include "chain-of-responsibility.h"
43
 
#include "form-request.h"
44
 
#include "menu-builder.h"
45
 
 
46
 
namespace Ekiga
47
 
{
48
 
  class ChatObserver
49
 
  {
50
 
  public:
51
 
 
52
 
    virtual ~ChatObserver () {}
53
 
 
54
 
    /** Tell the observer about a new user message, like :
55
 
     * observer.message ("Damien", "Hi Snark, did you fix bug #314159 ?");
56
 
     *
57
 
     */
58
 
    virtual void message (const std::string to,
59
 
                          const std::string msg) = 0;
60
 
 
61
 
    /** Tell the observer about a new service message, like :
62
 
     * observer.notice ("Snark just disconnected");
63
 
     *
64
 
     */
65
 
    virtual void notice (const std::string msg) = 0;
66
 
  };
67
 
 
68
 
 
69
 
  class Chat
70
 
  {
71
 
  public:
72
 
 
73
 
    /** The destructor.
74
 
     */
75
 
    virtual ~Chat ()
76
 
    {}
77
 
 
78
 
    /** Returns the title of the Chat.
79
 
     * @return The chat title.
80
 
     */
81
 
    virtual const std::string get_title () const = 0;
82
 
 
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
89
 
     */
90
 
    virtual void connect (ChatObserver &observer) = 0;
91
 
 
92
 
    /** Disconnects the new observer from the Chat
93
 
     * @param The observer to disconnect
94
 
     */
95
 
    virtual void disconnect (ChatObserver &observer) = 0;
96
 
 
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
108
 
     */
109
 
    virtual bool send_message (const std::string msg) = 0;
110
 
 
111
 
    /** This signal is emitted when the Chat has been updated.
112
 
     */
113
 
    sigc::signal<void> updated;
114
 
 
115
 
    /** This signal is emitted when the user requested to see this Chat
116
 
     */
117
 
    sigc::signal<void> user_requested;
118
 
 
119
 
    /** This signal is emitted when the Chat has been removed.
120
 
     */
121
 
    sigc::signal<void> removed;
122
 
 
123
 
    /** Feed possible actions on this Chat to the given MenuBuilder
124
 
     * @param A MenuBuilder object to populate.
125
 
     */
126
 
    virtual bool populate_menu (MenuBuilder &) = 0;
127
 
 
128
 
    /** This chain allows the Chat to present forms to the user.
129
 
     */
130
 
    ChainOfResponsibility<FormRequest*> questions;
131
 
  };
132
 
 
133
 
};
134
 
 
135
 
#endif