1 /* |
|
2 * text-mixin.h - Header for GabbleTextMixin |
|
3 * Copyright (C) 2006 Collabora Ltd. |
|
4 * |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Lesser General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2.1 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Lesser General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public |
|
17 * License along with this library; if not, write to the Free Software |
|
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 */ |
|
20 |
|
21 #ifndef __GABBLE_TEXT_MIXIN_H__ |
|
22 #define __GABBLE_TEXT_MIXIN_H__ |
|
23 |
|
24 #include "handles.h" |
|
25 #include "handle-set.h" |
|
26 #include "util.h" |
|
27 |
|
28 typedef enum { |
|
29 CHANNEL_TEXT_SEND_ERROR_UNKNOWN = 0, |
|
30 CHANNEL_TEXT_SEND_ERROR_OFFLINE, |
|
31 CHANNEL_TEXT_SEND_ERROR_INVALID_CONTACT, |
|
32 CHANNEL_TEXT_SEND_ERROR_PERMISSION_DENIED, |
|
33 CHANNEL_TEXT_SEND_ERROR_TOO_LONG, |
|
34 CHANNEL_TEXT_SEND_ERROR_NOT_IMPLEMENTED, |
|
35 |
|
36 CHANNEL_TEXT_SEND_NO_ERROR = -1 |
|
37 } GabbleTextMixinSendError; |
|
38 |
|
39 G_BEGIN_DECLS |
|
40 |
|
41 typedef struct _GabbleTextMixinClass GabbleTextMixinClass; |
|
42 typedef struct _GabbleTextMixin GabbleTextMixin; |
|
43 |
|
44 struct _GabbleTextMixinClass { |
|
45 guint lost_message_signal_id; |
|
46 guint received_signal_id; |
|
47 guint send_error_signal_id; |
|
48 guint sent_signal_id; |
|
49 }; |
|
50 |
|
51 struct _GabbleTextMixin { |
|
52 GabbleHandleRepo *handle_repo; |
|
53 guint recv_id; |
|
54 gboolean send_nick; |
|
55 gboolean message_lost; |
|
56 |
|
57 GQueue *pending; |
|
58 |
|
59 GArray *msg_types; |
|
60 }; |
|
61 |
|
62 GType gabble_text_mixin_get_type(void); |
|
63 |
|
64 /* TYPE MACROS */ |
|
65 #define GABBLE_TEXT_MIXIN_CLASS_OFFSET_QUARK (gabble_text_mixin_class_get_offset_quark()) |
|
66 #define GABBLE_TEXT_MIXIN_CLASS_OFFSET(o) (GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_CLASS_TYPE (o), GABBLE_TEXT_MIXIN_CLASS_OFFSET_QUARK))) |
|
67 #define GABBLE_TEXT_MIXIN_CLASS(o) ((GabbleTextMixinClass *) gabble_mixin_offset_cast (o, GABBLE_TEXT_MIXIN_CLASS_OFFSET (o))) |
|
68 |
|
69 #define GABBLE_TEXT_MIXIN_OFFSET_QUARK (gabble_text_mixin_get_offset_quark()) |
|
70 #define GABBLE_TEXT_MIXIN_OFFSET(o) (GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_TYPE (o), GABBLE_TEXT_MIXIN_OFFSET_QUARK))) |
|
71 #define GABBLE_TEXT_MIXIN(o) ((GabbleTextMixin *) gabble_mixin_offset_cast (o, GABBLE_TEXT_MIXIN_OFFSET (o))) |
|
72 |
|
73 GQuark gabble_text_mixin_class_get_offset_quark (void); |
|
74 GQuark gabble_text_mixin_get_offset_quark (void); |
|
75 |
|
76 void gabble_text_mixin_class_init (GObjectClass *obj_cls, glong offset); |
|
77 void gabble_text_mixin_init (GObject *obj, glong offset, GabbleHandleRepo *handle_repo, gboolean send_nick); |
|
78 void gabble_text_mixin_set_message_types (GObject *obj, ...); |
|
79 void gabble_text_mixin_finalize (GObject *obj); |
|
80 |
|
81 gboolean gabble_text_mixin_receive (GObject *obj, TpChannelTextMessageType type, GabbleHandle sender, time_t timestamp, const char *text); |
|
82 gboolean gabble_text_mixin_acknowledge_pending_messages (GObject *obj, const GArray * ids, GError **error); |
|
83 gboolean gabble_text_mixin_list_pending_messages (GObject *obj, gboolean clear, GPtrArray ** ret, GError **error); |
|
84 gboolean gabble_text_mixin_send (GObject *obj, guint type, guint subtype, const char * recipient, const gchar * text, GabbleConnection *conn, gboolean emit_signal, GError **error); |
|
85 void gabble_text_mixin_emit_sent (GObject *obj, time_t timestamp, guint type, const char *text); |
|
86 gboolean gabble_text_mixin_get_message_types (GObject *obj, GArray **ret, GError **error); |
|
87 void gabble_text_mixin_clear (GObject *obj); |
|
88 |
|
89 gboolean gabble_text_mixin_parse_incoming_message (LmMessage *message, const gchar **from, time_t *stamp, TpChannelTextMessageType *msgtype, const gchar **body, const gchar **body_offset, GabbleTextMixinSendError *send_error); |
|
90 |
|
91 void _gabble_text_mixin_send_error_signal (GObject *obj, GabbleTextMixinSendError error, time_t timestamp, TpChannelTextMessageType type, const gchar *text); |
|
92 |
|
93 G_END_DECLS |
|
94 |
|
95 #endif /* #ifndef __GABBLE_TEXT_MIXIN_H__ */ |
|
96 |
|