Changes in protocols/nogaim.h [acd61b9:85023c6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.h
racd61b9 r85023c6 61 61 #define OPT_AWAY 0x00000004 62 62 #define OPT_DOES_HTML 0x00000010 63 #define OPT_LOCALBUDDY 0x00000020 /* For nicks local to one groupchat */ 63 64 #define OPT_TYPING 0x00000100 /* Some pieces of code make assumptions */ 64 65 #define OPT_THINKING 0x00000200 /* about these values... Stupid me! */ … … 91 92 irc_t *irc; 92 93 93 struct groupchat * conversations;94 struct groupchat *groupchats; 94 95 }; 95 96 … … 97 98 struct im_connection *ic; 98 99 99 /* stuff used just for chat */100 /* The in_room variable is a list of handles (not nicks!), kind of101 * "nick list". This is how you can check who is in the group chat102 * already, for example to avoid adding somebody two times. */103 100 GList *in_room; 104 101 GList *ignored; 105 102 106 /* BitlBee */107 103 struct groupchat *next; 108 104 char *channel; 109 /* The title variable contains the ID you gave when you created the110 * chat using imcb_chat_new(). */111 105 char *title; 112 106 char joined; 113 /* This is for you, you can add your own structure here to extend this114 * structure for your protocol's needs. */115 107 void *data; 116 108 }; … … 131 123 struct prpl { 132 124 int options; 133 /* You should set this to the name of your protocol.134 * - The user sees this name ie. when imcb_log() is used. */135 125 const char *name; 136 126 137 127 /* Added this one to be able to add per-account settings, don't think 138 * it should be used for anything else. You are supposed to use the 139 * set_add() function to add new settings. */ 128 it should be used for anything else. */ 140 129 void (* init) (account_t *); 141 /* The typical usage of the login() function: 142 * - Create an im_connection using imcb_new() from the account_t parameter. 143 * - Initialize your myproto_data struct - you should store all your protocol-specific data there. 144 * - Save your custom structure to im_connection->proto_data. 145 * - Use proxy_connect() to connect to the server. 146 */ 130 /* These should all be pretty obvious. */ 147 131 void (* login) (account_t *); 148 /* Implementing this function is optional. */149 132 void (* keepalive) (struct im_connection *); 150 /* In this function you should:151 * - Tell the server about you are logging out.152 * - g_free() your myproto_data struct as BitlBee does not know how to153 * properly do so.154 */155 133 void (* logout) (struct im_connection *); 156 134 157 /* This function is called when the user wants to send a message to a handle.158 * - 'to' is a handle, not a nick159 * - 'flags' may be ignored160 */161 135 int (* buddy_msg) (struct im_connection *, char *to, char *message, int flags); 162 /* This function is called then the user uses the /away IRC command.163 * - 'state' contains the away reason.164 * - 'message' may be ignored if your protocol does not support it.165 */166 136 void (* set_away) (struct im_connection *, char *state, char *message); 167 /* Implementing this function is optional. */168 137 void (* get_away) (struct im_connection *, char *who); 169 /* Implementing this function is optional. */170 138 int (* send_typing) (struct im_connection *, char *who, int flags); 171 139 172 /* 'name' is a handle to add/remove. For now BitlBee doesn't really 173 * handle groups, just set it to NULL, so you can ignore that 174 * parameter. */ 140 /* For now BitlBee doesn't really handle groups, just set it to NULL. */ 175 141 void (* add_buddy) (struct im_connection *, char *name, char *group); 176 142 void (* remove_buddy) (struct im_connection *, char *name, char *group); 177 143 178 /* Block list stuff. Implementing these are optional.*/144 /* Block list stuff. */ 179 145 void (* add_permit) (struct im_connection *, char *who); 180 146 void (* add_deny) (struct im_connection *, char *who); … … 185 151 186 152 /* Request profile info. Free-formatted stuff, the IM module gives back 187 this info via imcb_log(). Implementing these are optional.*/153 this info via imcb_log(). */ 188 154 void (* get_info) (struct im_connection *, char *who); 189 155 void (* set_my_name) (struct im_connection *, char *name); … … 191 157 192 158 /* Group chat stuff. */ 193 /* This is called when the user uses the /invite IRC command.194 * - 'who' may be ignored195 * - 'message' is a handle to invite196 */197 159 void (* chat_invite) (struct groupchat *, char *who, char *message); 198 /* This is called when the user uses the /part IRC command in a group199 * chat. You just should tell the user about it, nothing more. */200 160 void (* chat_leave) (struct groupchat *); 201 /* This is called when the user sends a message to the groupchat.202 * 'flags' may be ignored. */203 161 void (* chat_msg) (struct groupchat *, char *message, int flags); 204 /* This is called when the user uses the /join #nick IRC command.205 * - 'who' is the handle of the nick206 */207 162 struct groupchat * 208 163 (* chat_with) (struct im_connection *, char *who); 209 /* This is used when the user uses the /join #channel IRC command. If210 * your protocol does not support publicly named group chats, then do211 * not implement this. */212 164 struct groupchat * 213 165 (* chat_join) (struct im_connection *, char *room, char *nick, char *password); 214 166 215 /* You can tell what away states your protocol supports, so that216 * BitlBee will try to map the IRC away reasons to them, or use217 * GAIM_AWAY_CUSTOM when calling skype_set_away(). */218 167 GList *(* away_states)(struct im_connection *ic); 219 168 220 /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* 221 * - Most protocols will just want to set this to g_strcasecmp().*/ 169 /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh* */ 222 170 int (* handle_cmp) (const char *who1, const char *who2); 223 171 }; … … 227 175 G_MODULE_EXPORT GSList *get_connections(); 228 176 G_MODULE_EXPORT struct prpl *find_protocol( const char *name ); 229 /* When registering a new protocol, you should allocate space for a new prpl230 * struct, initialize it (set the function pointers to point to your231 * functions), finally call this function. */232 177 G_MODULE_EXPORT void register_protocol( struct prpl * ); 233 178 234 179 /* Connection management. */ 235 /* You will need this function in prpl->login() to get an im_connection from236 * the account_t parameter. */237 180 G_MODULE_EXPORT struct im_connection *imcb_new( account_t *acc ); 238 181 G_MODULE_EXPORT void imcb_free( struct im_connection *ic ); 239 /* Once you're connected, you should call this function, so that the user will240 * see the success. */241 182 G_MODULE_EXPORT void imcb_connected( struct im_connection *ic ); 242 /* This can be used to disconnect when something went wrong (ie. read error243 * from the server). You probably want to set the second parameter to TRUE. */244 183 G_MODULE_EXPORT void imc_logout( struct im_connection *ic, int allow_reconnect ); 245 184 246 185 /* Communicating with the user. */ 247 /* A printf()-like function to tell the user anything you want. */248 186 G_MODULE_EXPORT void imcb_log( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 249 /* To tell the user an error, ie. before logging out when an error occurs. */250 187 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 ); 251 /* To ask a your about something.252 * - 'msg' is the question.253 * - 'data' can be your custom struct - it will be passed to the callbacks.254 * - 'doit' or 'dont' will be called depending of the answer of the user.255 */256 188 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ); 257 189 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 258 190 259 191 /* Buddy management */ 260 /* This function should be called for each handle which are visible to the261 * user, usually after a login. */262 192 G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ); 263 193 G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ); 264 194 G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ); 265 195 G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ); 196 G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick ); 266 197 267 198 /* Buddy activity */ 268 /* To manipulate the status of a handle.269 * - flags can be |='d with OPT_* constants. You will need at least:270 * OPT_LOGGED_IN and OPT_AWAY.271 * - 'state' and 'message' can be NULL */272 199 G_MODULE_EXPORT void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, const char *state, const char *message ); 273 200 /* Not implemented yet! */ G_MODULE_EXPORT void imcb_buddy_times( struct im_connection *ic, const char *handle, time_t login, time_t idle ); 274 /* Call when a handle says something. 'flags' and 'sent_at may be just 0. */275 201 G_MODULE_EXPORT void imcb_buddy_msg( struct im_connection *ic, char *handle, char *msg, u_int32_t flags, time_t sent_at ); 276 202 G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, char *handle, u_int32_t flags ); 203 G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle ); 277 204 278 205 /* Groupchats */ 279 206 G_MODULE_EXPORT void imcb_chat_invited( struct im_connection *ic, char *handle, char *who, char *msg, GList *data ); 280 /* These two functions are to create a group chat.281 * - imcb_chat_new(): the 'handle' parameter identifies the chat, like the282 * channel name on IRC.283 * - After you have a groupchat pointer, you should add the handles, finally284 * the user her/himself. At that point the group chat will be visible to the285 * user, too. */286 207 G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, char *handle ); 287 208 G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, char *handle ); 288 /* To remove a handle from a group chat. Reason can be NULL. */289 209 G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason ); 290 /* To tell BitlBee 'who' said 'msg' in 'c'. 'flags' and 'sent_at' can be 0. */291 210 G_MODULE_EXPORT void imcb_chat_msg( struct groupchat *c, char *who, char *msg, u_int32_t flags, time_t sent_at ); 292 G_MODULE_EXPORT void imcb_chat_removed( struct groupchat *c ); 293 struct groupchat *chat_by_channel( char *channel ); 211 G_MODULE_EXPORT void imcb_chat_free( struct groupchat *c ); 294 212 295 213 /* Actions, or whatever. */
Note: See TracChangeset
for help on using the changeset viewer.