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, gaim_connection, prpl, etc. */
00028 
00029 #ifndef _GAIM_PRPL_H_
00030 #define _GAIM_PRPL_H_
00031 
00032 typedef struct _GaimPluginProtocolInfo GaimPluginProtocolInfo;
00033 
00034 /**************************************************************************/
00036 /**************************************************************************/
00040 #define GAIM_PRPL_DESC(x) \
00041         "Allows gaim to use the " (x) " protocol.\n\n"      \
00042         "Now that you have loaded this protocol, use the "  \
00043         "Account Editor to add an account that uses this "  \
00044         "protocol. You can access the Account Editor from " \
00045         "the \"Accounts\" button on the login window or "   \
00046         "in the \"Tools\" menu in the buddy list window."
00047 
00049 #define GAIM_PROTO_DEFAULT "prpl-oscar"
00050 
00056 typedef enum
00057 {
00058     GAIM_CONV_IM_AUTO_RESP = 0x0001,    
00059     GAIM_CONV_IM_IMAGES    = 0x0002     
00060 } GaimConvImFlags;
00061 
00062 typedef enum
00063 {
00064     GAIM_CONV_CHAT_WHISPER = 0x0001,    
00065     GAIM_CONV_CHAT_DELAYED = 0x0002     
00067 } GaimConvChatFlags;
00068 
00069 typedef enum {
00070     GAIM_ICON_SCALE_DISPLAY = 0x01,     
00071     GAIM_ICON_SCALE_SEND = 0x02         
00072 } GaimIconScaleRules;
00073 
00074 
00080 typedef struct {
00081     char *format;                       
00084     int min_width;                          
00085     int min_height;                         
00086     int max_width;                          
00087     int max_height;                         
00088     GaimIconScaleRules scale_rules;     
00089 } GaimBuddyIconSpec;
00090 
00091 /* This #define exists just to make it easier to fill out the buddy icon field in he prpl info struct for protocols that couldn't care less. */
00092 #define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0}
00093 
00094 #include "blist.h"
00095 #include "proxy.h"
00096 #include "plugin.h"
00097 
00098 struct proto_chat_entry {
00099     char *label;
00100     char *identifier;
00101     gboolean is_int;
00102     int min;
00103     int max;
00104     gboolean secret;
00105 };
00106 
00112 typedef enum
00113 {
00121     OPT_PROTO_UNIQUE_CHATNAME = 0x00000004,
00122 
00128     OPT_PROTO_CHAT_TOPIC = 0x00000008,
00129 
00136     OPT_PROTO_NO_PASSWORD = 0x00000010,
00137 
00143     OPT_PROTO_MAIL_CHECK = 0x00000020,
00144 
00160     OPT_PROTO_IM_IMAGE = 0x00000080,
00161 
00168     OPT_PROTO_PASSWORD_OPTIONAL = 0x00000100,
00169 
00175     OPT_PROTO_USE_POINTSIZE = 0x00000200,
00176 
00182     OPT_PROTO_NO_NORMALIZE_CONV = 0x00000400
00183 
00184 } GaimProtocolOptions;
00185 
00187 #define GAIM_AWAY_CUSTOM _("Custom")
00188 
00190 struct _GaimRoomlist;
00191 struct _GaimRoomlistRoom;
00192 
00199 struct _GaimPluginProtocolInfo
00200 {
00201     GaimProtocolOptions options;  
00203     GList *user_splits;      /* A GList of GaimAccountUserSplit */
00204     GList *protocol_options; /* A GList of GaimAccountOption    */
00205     
00206     GaimBuddyIconSpec icon_spec; /* The icon spec. */
00207     
00212     const char *(*list_icon)(GaimAccount *account, GaimBuddy *buddy);
00213 
00218     void (*list_emblems)(GaimBuddy *buddy, char **se, char **sw,
00219                           char **nw, char **ne);
00220 
00225     char *(*status_text)(GaimBuddy *buddy);
00226 
00230     char *(*tooltip_text)(GaimBuddy *buddy);
00231 
00232     GList *(*away_states)(GaimConnection *gc);
00233 
00234     GList *(*blist_node_menu)(GaimBlistNode *node);
00235     GList *(*chat_info)(GaimConnection *);
00236     GHashTable *(*chat_info_defaults)(GaimConnection *, const char *chat_name);
00237 
00238     /* All the server-related functions */
00239     void (*login)(GaimAccount *);
00240     void (*close)(GaimConnection *);
00241     int  (*send_im)(GaimConnection *, const char *who,
00242                     const char *message,
00243                     GaimConvImFlags flags);
00244     void (*set_info)(GaimConnection *, const char *info);
00245     int  (*send_typing)(GaimConnection *, const char *name, int typing);
00246     void (*get_info)(GaimConnection *, const char *who);
00247     void (*set_away)(GaimConnection *, const char *state, const char *message);
00248     void (*set_idle)(GaimConnection *, int idletime);
00249     void (*change_passwd)(GaimConnection *, const char *old_pass,
00250                           const char *new_pass);
00251     void (*add_buddy)(GaimConnection *, GaimBuddy *buddy, GaimGroup *group);
00252     void (*add_buddies)(GaimConnection *, GList *buddies, GList *groups);
00253     void (*remove_buddy)(GaimConnection *, GaimBuddy *buddy, GaimGroup *group);
00254     void (*remove_buddies)(GaimConnection *, GList *buddies, GList *groups);
00255     void (*add_permit)(GaimConnection *, const char *name);
00256     void (*add_deny)(GaimConnection *, const char *name);
00257     void (*rem_permit)(GaimConnection *, const char *name);
00258     void (*rem_deny)(GaimConnection *, const char *name);
00259     void (*set_permit_deny)(GaimConnection *);
00260     void (*warn)(GaimConnection *, const char *who, gboolean anonymous);
00261     void (*join_chat)(GaimConnection *, GHashTable *components);
00262     void (*reject_chat)(GaimConnection *, GHashTable *components);
00263     char *(*get_chat_name)(GHashTable *components);
00264     void (*chat_invite)(GaimConnection *, int id,
00265                         const char *who, const char *message);
00266     void (*chat_leave)(GaimConnection *, int id);
00267     void (*chat_whisper)(GaimConnection *, int id,
00268                          const char *who, const char *message);
00269     int  (*chat_send)(GaimConnection *, int id, const char *message);
00270     void (*keepalive)(GaimConnection *);
00271 
00272     /* new user registration */
00273     void (*register_user)(GaimAccount *);
00274 
00275     /* get "chat buddy" info and away message */
00276     void (*get_cb_info)(GaimConnection *, int, const char *who);
00277     void (*get_cb_away)(GaimConnection *, int, const char *who);
00278 
00279     /* save/store buddy's alias on server list/roster */
00280     void (*alias_buddy)(GaimConnection *, const char *who,
00281                         const char *alias);
00282 
00283     /* change a buddy's group on a server list/roster */
00284     void (*group_buddy)(GaimConnection *, const char *who,
00285                         const char *old_group, const char *new_group);
00286 
00287     /* rename a group on a server list/roster */
00288     void (*rename_group)(GaimConnection *, const char *old_name,
00289                          GaimGroup *group, GList *moved_buddies);
00290 
00291     void (*buddy_free)(GaimBuddy *);
00292 
00293     void (*convo_closed)(GaimConnection *, const char *who);
00294 
00295     const char *(*normalize)(const GaimAccount *, const char *);
00296 
00297     void (*set_buddy_icon)(GaimConnection *, const char *filename);
00298 
00299     void (*remove_group)(GaimConnection *gc, GaimGroup *group);
00300 
00301     char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who);
00302 
00303     void (*set_chat_topic)(GaimConnection *gc, int id, const char *topic);
00304 
00305     GaimChat *(*find_blist_chat)(GaimAccount *account, const char *name);
00306 
00307     /* room listing prpl callbacks */
00308     struct _GaimRoomlist *(*roomlist_get_list)(GaimConnection *gc);
00309     void (*roomlist_cancel)(struct _GaimRoomlist *list);
00310     void (*roomlist_expand_category)(struct _GaimRoomlist *list, struct _GaimRoomlistRoom *category);
00311 
00312     /* file transfer callbacks */
00313     gboolean (*can_receive_file)(GaimConnection *, const char *who);
00314     void (*send_file)(GaimConnection *, const char *who, const char *filename);
00315 };
00316 
00317 #define GAIM_IS_PROTOCOL_PLUGIN(plugin) \
00318     ((plugin)->info->type == GAIM_PLUGIN_PROTOCOL)
00319 
00320 #define GAIM_PLUGIN_PROTOCOL_INFO(plugin) \
00321     ((GaimPluginProtocolInfo *)(plugin)->info->extra_info)
00322 
00323 #ifdef __cplusplus
00324 extern "C" {
00325 #endif
00326 
00332 GaimPlugin *gaim_find_prpl(const char *id);
00333 
00334 #ifdef __cplusplus
00335 }
00336 #endif
00337 
00338 #endif /* _PRPL_H_ */

Generated on Sun Feb 18 08:38:28 2007 for gaim by  doxygen 1.5.1