prpl.h

Go to the documentation of this file.
00001 
00026 /* this file should be all that prpls need to include. therefore, by including
00027  * this file, they should get glib, proxy, purple_connection, prpl, etc. */
00028 
00029 #ifndef _PURPLE_PRPL_H_
00030 #define _PURPLE_PRPL_H_
00031 
00032 typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo;
00033 
00034 /**************************************************************************/
00036 /**************************************************************************/
00037 
00038 typedef enum {
00039     PURPLE_ICON_SCALE_DISPLAY = 0x01,       
00040     PURPLE_ICON_SCALE_SEND = 0x02           
00041 } PurpleIconScaleRules;
00042 
00043 
00049 typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec;
00050 
00055 #define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0, 0}
00056 
00057 #ifdef HAVE_UNISTD_H
00058 #include <unistd.h>
00059 #endif
00060 
00061 #include "blist.h"
00062 #include "conversation.h"
00063 #include "ft.h"
00064 #include "imgstore.h"
00065 #include "notify.h"
00066 #include "proxy.h"
00067 #include "plugin.h"
00068 #include "roomlist.h"
00069 #include "status.h"
00070 #include "whiteboard.h"
00071 
00072 struct _PurpleBuddyIconSpec {
00073     char *format;                       
00076     int min_width;                          
00077     int min_height;                         
00078     int max_width;                          
00079     int max_height;                         
00080     size_t max_filesize;                     
00081     PurpleIconScaleRules scale_rules;       
00082 };
00083 
00084 struct proto_chat_entry {
00085     const char *label;
00086     const char *identifier;
00087     gboolean required;
00088     gboolean is_int;
00089     int min;
00090     int max;
00091     gboolean secret;
00092 };
00093 
00099 typedef enum
00100 {
00108     OPT_PROTO_UNIQUE_CHATNAME = 0x00000004,
00109 
00115     OPT_PROTO_CHAT_TOPIC = 0x00000008,
00116 
00123     OPT_PROTO_NO_PASSWORD = 0x00000010,
00124 
00130     OPT_PROTO_MAIL_CHECK = 0x00000020,
00131 
00137     OPT_PROTO_IM_IMAGE = 0x00000040,
00138 
00145     OPT_PROTO_PASSWORD_OPTIONAL = 0x00000080,
00146 
00152     OPT_PROTO_USE_POINTSIZE = 0x00000100,
00153 
00159     OPT_PROTO_REGISTER_NOSCREENNAME = 0x00000200,
00160 
00165     OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400,
00166 
00167 } PurpleProtocolOptions;
00168 
00176 struct _PurplePluginProtocolInfo
00177 {
00178     PurpleProtocolOptions options;  
00180     GList *user_splits;      
00181     GList *protocol_options; 
00183     PurpleBuddyIconSpec icon_spec; 
00193     const char *(*list_icon)(PurpleAccount *account, PurpleBuddy *buddy);
00194 
00199     const char *(*list_emblem)(PurpleBuddy *buddy);
00200 
00205     char *(*status_text)(PurpleBuddy *buddy);
00206 
00210     void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full);
00211 
00216     GList *(*status_types)(PurpleAccount *account);
00217 
00218     GList *(*blist_node_menu)(PurpleBlistNode *node);
00219     GList *(*chat_info)(PurpleConnection *);
00220     GHashTable *(*chat_info_defaults)(PurpleConnection *, const char *chat_name);
00221 
00222     /* All the server-related functions */
00223 
00225     void (*login)(PurpleAccount *);
00226 
00228     void (*close)(PurpleConnection *);
00229 
00239     int  (*send_im)(PurpleConnection *, const char *who,
00240                     const char *message,
00241                     PurpleMessageFlags flags);
00242 
00243     void (*set_info)(PurpleConnection *, const char *info);
00244     unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleTypingState state);
00245     void (*get_info)(PurpleConnection *, const char *who);
00246     void (*set_status)(PurpleAccount *account, PurpleStatus *status);
00247 
00248     void (*set_idle)(PurpleConnection *, int idletime);
00249     void (*change_passwd)(PurpleConnection *, const char *old_pass,
00250                           const char *new_pass);
00251     void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
00252     void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups);
00253     void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
00254     void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups);
00255     void (*add_permit)(PurpleConnection *, const char *name);
00256     void (*add_deny)(PurpleConnection *, const char *name);
00257     void (*rem_permit)(PurpleConnection *, const char *name);
00258     void (*rem_deny)(PurpleConnection *, const char *name);
00259     void (*set_permit_deny)(PurpleConnection *);
00260     void (*join_chat)(PurpleConnection *, GHashTable *components);
00261     void (*reject_chat)(PurpleConnection *, GHashTable *components);
00262     char *(*get_chat_name)(GHashTable *components);
00263     void (*chat_invite)(PurpleConnection *, int id,
00264                         const char *message, const char *who);
00265     void (*chat_leave)(PurpleConnection *, int id);
00266     void (*chat_whisper)(PurpleConnection *, int id,
00267                          const char *who, const char *message);
00268     int  (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);
00269     void (*keepalive)(PurpleConnection *);
00270 
00272     void (*register_user)(PurpleAccount *);
00273 
00274     /* get "chat buddy" info and away message */
00275     void (*get_cb_info)(PurpleConnection *, int, const char *who);
00276     void (*get_cb_away)(PurpleConnection *, int, const char *who);
00277 
00279     void (*alias_buddy)(PurpleConnection *, const char *who,
00280                         const char *alias);
00281 
00283     void (*group_buddy)(PurpleConnection *, const char *who,
00284                         const char *old_group, const char *new_group);
00285 
00287     void (*rename_group)(PurpleConnection *, const char *old_name,
00288                          PurpleGroup *group, GList *moved_buddies);
00289 
00290     void (*buddy_free)(PurpleBuddy *);
00291 
00292     void (*convo_closed)(PurpleConnection *, const char *who);
00293 
00299     const char *(*normalize)(const PurpleAccount *, const char *who);
00300 
00306     void (*set_buddy_icon)(PurpleConnection *, PurpleStoredImage *img);
00307 
00308     void (*remove_group)(PurpleConnection *gc, PurpleGroup *group);
00309 
00310     char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who);
00311 
00312     void (*set_chat_topic)(PurpleConnection *gc, int id, const char *topic);
00313 
00314     PurpleChat *(*find_blist_chat)(PurpleAccount *account, const char *name);
00315 
00316     /* room listing prpl callbacks */
00317     PurpleRoomlist *(*roomlist_get_list)(PurpleConnection *gc);
00318     void (*roomlist_cancel)(PurpleRoomlist *list);
00319     void (*roomlist_expand_category)(PurpleRoomlist *list, PurpleRoomlistRoom *category);
00320 
00321     /* file transfer callbacks */
00322     gboolean (*can_receive_file)(PurpleConnection *, const char *who);
00323     void (*send_file)(PurpleConnection *, const char *who, const char *filename);
00324     PurpleXfer *(*new_xfer)(PurpleConnection *, const char *who);
00325     gboolean (*offline_message)(const PurpleBuddy *buddy);
00326 
00327     PurpleWhiteboardPrplOps *whiteboard_prpl_ops;
00328 
00330     int (*send_raw)(PurpleConnection *gc, const char *buf, int len);
00331 
00332     /* room list serialize */
00333     char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room);
00334 
00335     void (*_purple_reserved1)(void);
00336     void (*_purple_reserved2)(void);
00337     void (*_purple_reserved3)(void);
00338     void (*_purple_reserved4)(void);
00339 };
00340 
00341 #define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \
00342     ((plugin)->info->type == PURPLE_PLUGIN_PROTOCOL)
00343 
00344 #define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \
00345     ((PurplePluginProtocolInfo *)(plugin)->info->extra_info)
00346 
00347 #ifdef __cplusplus
00348 extern "C" {
00349 #endif
00350 
00351 /**************************************************************************/
00353 /**************************************************************************/
00365 void purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle,
00366                                 time_t idle_time);
00367 
00376 void purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time);
00377 
00388 void purple_prpl_got_account_status(PurpleAccount *account,
00389                                   const char *status_id, ...) G_GNUC_NULL_TERMINATED;
00402 void purple_prpl_got_user_idle(PurpleAccount *account, const char *name,
00403                              gboolean idle, time_t idle_time);
00404 
00414 void purple_prpl_got_user_login_time(PurpleAccount *account, const char *name,
00415                                    time_t login_time);
00416 
00428 void purple_prpl_got_user_status(PurpleAccount *account, const char *name,
00429                                const char *status_id, ...) G_GNUC_NULL_TERMINATED;
00430 
00440 void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name,
00441                     const char *status_id);
00442  
00451 void purple_prpl_change_account_status(PurpleAccount *account,
00452                                      PurpleStatus *old_status,
00453                                      PurpleStatus *new_status);
00454 
00463 GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence);
00464 
00467 /**************************************************************************/
00469 /**************************************************************************/
00477 PurplePlugin *purple_find_prpl(const char *id);
00478 
00481 #ifdef __cplusplus
00482 }
00483 #endif
00484 
00485 #endif /* _PRPL_H_ */