|
Evan@653
|
1 |
/** |
|
Evan@653
|
2 |
* @file server.h Server API |
|
Evan@653
|
3 |
* @ingroup core |
|
Evan@653
|
4 |
*/ |
|
Evan@653
|
5 |
|
|
Evan@653
|
6 |
/* purple |
|
Evan@653
|
7 |
* |
|
Evan@653
|
8 |
* Purple is the legal property of its developers, whose names are too numerous |
|
Evan@653
|
9 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
Evan@653
|
10 |
* source distribution. |
|
Evan@653
|
11 |
* |
|
Evan@653
|
12 |
* This program is free software; you can redistribute it and/or modify |
|
Evan@653
|
13 |
* it under the terms of the GNU General Public License as published by |
|
Evan@653
|
14 |
* the Free Software Foundation; either version 2 of the License, or |
|
Evan@653
|
15 |
* (at your option) any later version. |
|
Evan@653
|
16 |
* |
|
Evan@653
|
17 |
* This program is distributed in the hope that it will be useful, |
|
Evan@653
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
Evan@653
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
Evan@653
|
20 |
* GNU General Public License for more details. |
|
Evan@653
|
21 |
* |
|
Evan@653
|
22 |
* You should have received a copy of the GNU General Public License |
|
Evan@653
|
23 |
* along with this program; if not, write to the Free Software |
|
Evan@653
|
24 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
Evan@653
|
25 |
*/ |
|
Evan@653
|
26 |
#ifndef _PURPLE_SERVER_H_ |
|
Evan@653
|
27 |
#define _PURPLE_SERVER_H_ |
|
Evan@653
|
28 |
|
|
Evan@653
|
29 |
#include "account.h" |
|
Evan@653
|
30 |
#include "conversation.h" |
|
Evan@653
|
31 |
#include "prpl.h" |
|
Evan@653
|
32 |
|
|
Evan@653
|
33 |
#ifdef __cplusplus |
|
Evan@653
|
34 |
extern "C" { |
|
Evan@653
|
35 |
#endif |
|
Evan@653
|
36 |
|
|
Evan@653
|
37 |
/** |
|
Evan@653
|
38 |
* Send a typing message to a given user over a given connection. |
|
Evan@653
|
39 |
* |
|
Evan@653
|
40 |
* TODO: Could probably move this into the conversation API. |
|
Evan@653
|
41 |
* |
|
Evan@653
|
42 |
* @param gc The connection over which to send the typing notification. |
|
Evan@653
|
43 |
* @param name The user to send the typing notification to. |
|
Evan@653
|
44 |
* @param state One of PURPLE_TYPING, PURPLE_TYPED, or PURPLE_NOT_TYPING. |
|
Evan@653
|
45 |
* @return A quiet-period, specified in seconds, where Purple will not |
|
Evan@653
|
46 |
* send any additional typing notification messages. Most |
|
Evan@653
|
47 |
* protocols should return 0, which means that no additional |
|
Evan@653
|
48 |
* PURPLE_TYPING messages need to be sent. If this is 5, for |
|
Evan@653
|
49 |
* example, then Purple will wait five seconds, and if the Purple |
|
Evan@653
|
50 |
* user is still typing then Purple will send another PURPLE_TYPING |
|
Evan@653
|
51 |
* message. |
|
Evan@653
|
52 |
*/ |
|
Evan@653
|
53 |
unsigned int serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); |
|
Evan@653
|
54 |
|
|
Evan@653
|
55 |
void serv_move_buddy(PurpleBuddy *, PurpleGroup *, PurpleGroup *); |
|
Evan@653
|
56 |
int serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageFlags flags); |
|
Evan@653
|
57 |
|
|
Evan@1427
|
58 |
/** Get information about an account's attention commands, from the prpl. |
|
Evan@1427
|
59 |
* |
|
Evan@653
|
60 |
* @return The attention command numbered 'code' from the prpl's attention_types, or NULL. |
|
Evan@653
|
61 |
*/ |
|
Evan@653
|
62 |
PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); |
|
Evan@653
|
63 |
|
|
Evan@653
|
64 |
/** Send an attention request message. |
|
Evan@653
|
65 |
* |
|
Evan@653
|
66 |
* @deprecated Use purple_prpl_send_attention() instead. |
|
Evan@653
|
67 |
* |
|
Evan@653
|
68 |
* @param gc The connection to send the message on. |
|
Evan@653
|
69 |
* @param who Whose attention to request. |
|
Evan@653
|
70 |
* @param type_code An index into the prpl's attention_types list determining the type |
|
Evan@653
|
71 |
* of the attention request command to send. 0 if prpl only defines one |
|
Evan@653
|
72 |
* (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). |
|
Evan@653
|
73 |
* |
|
Evan@653
|
74 |
* Note that you can't send arbitrary PurpleAttentionType's, because there is |
|
Evan@653
|
75 |
* only a fixed set of attention commands. |
|
Evan@653
|
76 |
*/ |
|
Evan@653
|
77 |
void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); |
|
Evan@653
|
78 |
|
|
Evan@1427
|
79 |
/** Process an incoming attention message. |
|
Evan@653
|
80 |
* |
|
Evan@653
|
81 |
* @deprecated Use purple_prpl_got_attention() instead. |
|
Evan@653
|
82 |
* |
|
Evan@653
|
83 |
* @param gc The connection that received the attention message. |
|
Evan@653
|
84 |
* @param who Who requested your attention. |
|
Evan@653
|
85 |
* @param type_code An index into the prpl's attention_types list determining the type |
|
Evan@1427
|
86 |
* of the attention request command to send. |
|
Evan@653
|
87 |
*/ |
|
Evan@653
|
88 |
void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); |
|
Evan@653
|
89 |
|
|
Evan@653
|
90 |
void serv_get_info(PurpleConnection *, const char *); |
|
Evan@653
|
91 |
void serv_set_info(PurpleConnection *, const char *); |
|
Evan@653
|
92 |
|
|
Evan@653
|
93 |
void serv_add_permit(PurpleConnection *, const char *); |
|
Evan@653
|
94 |
void serv_add_deny(PurpleConnection *, const char *); |
|
Evan@653
|
95 |
void serv_rem_permit(PurpleConnection *, const char *); |
|
Evan@653
|
96 |
void serv_rem_deny(PurpleConnection *, const char *); |
|
Evan@653
|
97 |
void serv_set_permit_deny(PurpleConnection *); |
|
Evan@653
|
98 |
void serv_chat_invite(PurpleConnection *, int, const char *, const char *); |
|
Evan@653
|
99 |
void serv_chat_leave(PurpleConnection *, int); |
|
Evan@653
|
100 |
void serv_chat_whisper(PurpleConnection *, int, const char *, const char *); |
|
Evan@653
|
101 |
int serv_chat_send(PurpleConnection *, int, const char *, PurpleMessageFlags flags); |
|
Evan@653
|
102 |
void serv_alias_buddy(PurpleBuddy *); |
|
Evan@653
|
103 |
void serv_got_alias(PurpleConnection *gc, const char *who, const char *alias); |
|
Evan@653
|
104 |
|
|
Evan@653
|
105 |
/** |
|
Evan@653
|
106 |
* A protocol plugin should call this when it retrieves a private alias from |
|
Evan@653
|
107 |
* the server. Private aliases are the aliases the user sets, while public |
|
Evan@653
|
108 |
* aliases are the aliases or display names that buddies set for themselves. |
|
Evan@653
|
109 |
* |
|
Evan@653
|
110 |
* @param gc The connection on which the alias was received. |
|
Evan@1427
|
111 |
* @param who The name of the buddy whose alias was received. |
|
Evan@653
|
112 |
* @param alias The alias that was received. |
|
Evan@653
|
113 |
*/ |
|
Evan@653
|
114 |
void purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias); |
|
Evan@653
|
115 |
|
|
Evan@653
|
116 |
|
|
Evan@653
|
117 |
/** |
|
Evan@653
|
118 |
* Receive a typing message from a remote user. Either PURPLE_TYPING |
|
Evan@653
|
119 |
* or PURPLE_TYPED. If the user has stopped typing then use |
|
Evan@653
|
120 |
* serv_got_typing_stopped instead. |
|
Evan@653
|
121 |
* |
|
Evan@653
|
122 |
* TODO: Could probably move this into the conversation API. |
|
Evan@653
|
123 |
* |
|
Evan@653
|
124 |
* @param gc The connection on which the typing message was received. |
|
Evan@653
|
125 |
* @param name The name of the remote user. |
|
Evan@653
|
126 |
* @param timeout If this is a number greater than 0, then |
|
Evan@653
|
127 |
* Purple will wait this number of seconds and then |
|
Evan@653
|
128 |
* set this buddy to the PURPLE_NOT_TYPING state. This |
|
Evan@653
|
129 |
* is used by protocols that send repeated typing messages |
|
Evan@653
|
130 |
* while the user is composing the message. |
|
Evan@653
|
131 |
* @param state The typing state received |
|
Evan@653
|
132 |
*/ |
|
Evan@653
|
133 |
void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
|
Evan@653
|
134 |
PurpleTypingState state); |
|
Evan@653
|
135 |
|
|
Evan@653
|
136 |
/** |
|
Evan@653
|
137 |
* TODO: Could probably move this into the conversation API. |
|
Evan@653
|
138 |
*/ |
|
Evan@653
|
139 |
void serv_got_typing_stopped(PurpleConnection *gc, const char *name); |
|
Evan@653
|
140 |
|
|
Evan@653
|
141 |
void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, |
|
Evan@653
|
142 |
PurpleMessageFlags flags, time_t mtime); |
|
Evan@653
|
143 |
|
|
Evan@653
|
144 |
/** |
|
Evan@653
|
145 |
* @param data The hash function should be g_str_hash() and the equal |
|
Evan@653
|
146 |
* function should be g_str_equal(). |
|
Evan@653
|
147 |
*/ |
|
Evan@653
|
148 |
void serv_join_chat(PurpleConnection *, GHashTable *data); |
|
Evan@653
|
149 |
|
|
Evan@653
|
150 |
/** |
|
Evan@653
|
151 |
* @param data The hash function should be g_str_hash() and the equal |
|
Evan@653
|
152 |
* function should be g_str_equal(). |
|
Evan@653
|
153 |
*/ |
|
Evan@653
|
154 |
void serv_reject_chat(PurpleConnection *, GHashTable *data); |
|
Evan@653
|
155 |
|
|
Evan@653
|
156 |
/** |
|
Evan@653
|
157 |
* Called by a prpl when an account is invited into a chat. |
|
Evan@653
|
158 |
* |
|
Evan@653
|
159 |
* @param gc The connection on which the invite arrived. |
|
Evan@653
|
160 |
* @param name The name of the chat you're being invited to. |
|
Evan@653
|
161 |
* @param who The username of the person inviting the account. |
|
Evan@653
|
162 |
* @param message The optional invite message. |
|
Evan@653
|
163 |
* @param data The components necessary if you want to call serv_join_chat(). |
|
Evan@653
|
164 |
* The hash function should be g_str_hash() and the equal |
|
Evan@653
|
165 |
* function should be g_str_equal(). |
|
Evan@653
|
166 |
*/ |
|
Evan@653
|
167 |
void serv_got_chat_invite(PurpleConnection *gc, const char *name, |
|
Evan@653
|
168 |
const char *who, const char *message, |
|
Evan@653
|
169 |
GHashTable *data); |
|
Evan@653
|
170 |
|
|
Evan@653
|
171 |
PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, |
|
Evan@653
|
172 |
int id, const char *name); |
|
Evan@653
|
173 |
/** |
|
Evan@653
|
174 |
* Called by a prpl when an attempt to join a chat via serv_join_chat() |
|
Evan@653
|
175 |
* fails. |
|
Evan@653
|
176 |
* |
|
Evan@653
|
177 |
* @param gc The connection on which chat joining failed |
|
Evan@653
|
178 |
* @param data The components passed to serv_join_chat() originally. |
|
Evan@653
|
179 |
* The hash function should be g_str_hash() and the equal |
|
Evan@653
|
180 |
* function should be g_str_equal(). |
|
Evan@653
|
181 |
*/ |
|
Evan@653
|
182 |
void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data); |
|
Evan@1427
|
183 |
|
|
Evan@653
|
184 |
void serv_got_chat_left(PurpleConnection *g, int id); |
|
Evan@653
|
185 |
void serv_got_chat_in(PurpleConnection *g, int id, const char *who, |
|
Evan@653
|
186 |
PurpleMessageFlags flags, const char *message, time_t mtime); |
|
Evan@653
|
187 |
void serv_send_file(PurpleConnection *gc, const char *who, const char *file); |
|
Evan@653
|
188 |
|
|
Evan@653
|
189 |
#ifdef __cplusplus |
|
Evan@653
|
190 |
} |
|
Evan@653
|
191 |
#endif |
|
Evan@653
|
192 |
|
|
Evan@653
|
193 |
#endif /* _PURPLE_SERVER_H_ */ |