libpurple/purpleconversationuiops.h

changeset 42706
6039c89f2f5c
parent 42705
e78a46048ae7
child 42707
41b4d8fdde2e
equal deleted inserted replaced
42705:e78a46048ae7 42706:6039c89f2f5c
1 /*
2 * Purple - Internet Messaging Library
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
4 *
5 * Purple is the legal property of its developers, whose names are too numerous
6 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * source distribution.
8 *
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this library; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
24 # error "only <purple.h> may be included directly"
25 #endif
26
27 #ifndef PURPLE_CONVERSATION_UI_OPS_H
28 #define PURPLE_CONVERSATION_UI_OPS_H
29
30 #include <glib.h>
31 #include <glib-object.h>
32
33 #define PURPLE_TYPE_CONVERSATION_UI_OPS (purple_conversation_ui_ops_get_type())
34 typedef struct _PurpleConversationUiOps PurpleConversationUiOps;
35
36 #include "purplechatconversation.h"
37 #include "purpleconversation.h"
38 #include "purpleimconversation.h"
39 #include "purplemessage.h"
40
41 /**
42 * PurpleConversationUiOps:
43 * @create_conversation: Called when @conv is created (but before the
44 * <link linkend="conversations-conversation-created"><literal>"conversation-created"</literal></link>
45 * signal is emitted).
46 * @destroy_conversation: Called just before @conv is freed.
47 * @write_chat: Write a message to a chat. If this field is %NULL, libpurple
48 * will fall back to using @write_conv.
49 * See purple_conversation_write_message().
50 * @write_im: Write a message to an IM conversation. If this field is %NULL,
51 * libpurple will fall back to using @write_conv.
52 * See purple_conversation_write_message().
53 * @write_conv: Write a message to a conversation. This is used rather than the
54 * chat- or im-specific ops for errors, system messages (such as "x
55 * is now know as y"), and as the fallback if @write_im and
56 * @write_chat are not implemented. It should be implemented, or
57 * the UI will miss conversation error messages and your users will
58 * hate you. See purple_conversation_write_message().
59 * @chat_add_users: Add @cbuddies to a chat.
60 * <sbr/>@cbuddies: A GList of #PurpleChatUser structs.
61 * <sbr/>@new_arrivals: Whether join notices should be shown.
62 * (Join notices are actually written to
63 * the conversation by
64 * purple_chat_conversation_add_users())
65 * @chat_rename_user: Rename the user in this chat named @old_name to @new_name.
66 * (The rename message is written to the conversation by
67 * libpurple.) See purple_chat_conversation_rename_user().
68 * <sbr/>@new_alias: @new_name's new alias, if they have one.
69 * @chat_remove_users: Remove @users from a chat @chat.
70 * See purple_chat_conversation_remove_users().
71 * @chat_update_user: Called when a user's flags are changed.
72 * See purple_chat_user_set_flags().
73 * @present: Present this conversation to the user; for example, by displaying
74 * the IM dialog.
75 * @has_focus: If this UI has a concept of focus (as in a windowing system) and
76 * this conversation has the focus, return %TRUE; otherwise, return
77 * %FALSE.
78 * @send_confirm: Prompt the user for confirmation to send @message. This
79 * function should arrange for the message to be sent if the user
80 * accepts. If this field is %NULL, libpurple will fall back to
81 * using purple_request_action().
82 *
83 * libpurple needs to tell the user interface when certain things happen in a
84 * conversation and it uses this structure to do so.
85 *
86 * Any UI representing a conversation must assign a filled-out
87 * #PurpleConversationUiOps structure to the #PurpleConversation.
88 */
89 struct _PurpleConversationUiOps
90 {
91 void (*create_conversation)(PurpleConversation *conv);
92 void (*destroy_conversation)(PurpleConversation *conv);
93
94 void (*write_chat)(PurpleChatConversation *chat, PurpleMessage *msg);
95 void (*write_im)(PurpleIMConversation *im, PurpleMessage *msg);
96 void (*write_conv)(PurpleConversation *conv, PurpleMessage *msg);
97
98 void (*chat_add_users)(PurpleChatConversation *chat,
99 GList *cbuddies,
100 gboolean new_arrivals);
101
102 void (*chat_rename_user)(PurpleChatConversation *chat, const char *old_name,
103 const char *new_name, const char *new_alias);
104
105 void (*chat_remove_users)(PurpleChatConversation *chat, GList *users);
106
107 void (*chat_update_user)(PurpleChatUser *cb);
108
109 void (*present)(PurpleConversation *conv);
110 gboolean (*has_focus)(PurpleConversation *conv);
111
112 void (*send_confirm)(PurpleConversation *conv, const char *message);
113
114 /*< private >*/
115 void (*_purple_reserved1)(void);
116 void (*_purple_reserved2)(void);
117 void (*_purple_reserved3)(void);
118 void (*_purple_reserved4)(void);
119 };
120
121 G_BEGIN_DECLS
122
123 /**
124 * purple_conversation_ui_ops_get_type:
125 *
126 * Returns: The #GType for the #PurpleConversationUiOps boxed structure.
127 *
128 * Since: 3.0
129 */
130 PURPLE_AVAILABLE_IN_3_0
131 GType purple_conversation_ui_ops_get_type(void);
132
133 G_END_DECLS
134
135 #endif /* PURPLE_CONVERSATION_UI_OPS_H */

mercurial