1 /*
2  * message-util.h - Header for Messages interface utility functions
3  * Copyright (C) 2008 Collabora Ltd.
4  * Copyright (C) 2008 Nokia Corporation
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_MESSAGE_UTIL_H__
22 #define __GABBLE_MESSAGE_UTIL_H__
23 
24 #include <telepathy-glib/telepathy-glib.h>
25 
26 #include <wocky/wocky.h>
27 #include <wocky/wocky.h>
28 
29 #include "connection.h"
30 
31 G_BEGIN_DECLS
32 
33 void gabble_message_util_add_chat_state (WockyStanza *stanza,
34     TpChannelChatState state);
35 
36 WockyStanza * gabble_message_util_build_stanza (TpMessage *message,
37     GabbleConnection *conn, WockyStanzaSubType subtype,
38     TpChannelChatState state, const char *recipient, gboolean send_nick,
39     gchar **token, GError **error);
40 
41 gboolean gabble_message_util_send_chat_state (GObject *obj,
42     GabbleConnection *conn, WockyStanzaSubType subtype, TpChannelChatState state,
43     const char *recipient, GError **error);
44 
45 
46 #define GABBLE_TEXT_CHANNEL_SEND_NO_ERROR ((TpChannelTextSendError)-1)
47 
48 gboolean gabble_message_util_parse_incoming_message (WockyStanza *message,
49     const gchar **from, time_t *stamp, TpChannelTextMessageType *msgtype,
50     const gchar **id, const gchar **body_ret, gint *state,
51     TpChannelTextSendError *send_error, TpDeliveryStatus *delivery_status);
52 
53 TpChannelTextSendError
54 gabble_tp_send_error_from_wocky_xmpp_error (WockyXmppError err);
55 
56 G_END_DECLS
57 
58 #endif /* #ifndef __GABBLE_MESSAGE_UTIL_H__ */
59