00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _PURPLE_PRPL_H_
00031 #define _PURPLE_PRPL_H_
00032
00033 typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo;
00035 typedef struct _PurpleAttentionType PurpleAttentionType;
00036
00037
00039
00040
00041 typedef enum {
00042 PURPLE_ICON_SCALE_DISPLAY = 0x01,
00043 PURPLE_ICON_SCALE_SEND = 0x02
00044 } PurpleIconScaleRules;
00045
00046
00052 typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec;
00053
00058 #define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0, 0}
00059
00060 #ifdef HAVE_UNISTD_H
00061 #include <unistd.h>
00062 #endif
00063
00064 #include "blist.h"
00065 #include "conversation.h"
00066 #include "ft.h"
00067 #include "imgstore.h"
00068 #include "notify.h"
00069 #include "proxy.h"
00070 #include "plugin.h"
00071 #include "roomlist.h"
00072 #include "status.h"
00073 #include "whiteboard.h"
00074
00075
00077 struct _PurpleBuddyIconSpec {
00083 char *format;
00084
00085 int min_width;
00086 int min_height;
00087 int max_width;
00088 int max_height;
00089 size_t max_filesize;
00090 PurpleIconScaleRules scale_rules;
00091 };
00092
00093 struct proto_chat_entry {
00094 const char *label;
00095 const char *identifier;
00096 gboolean required;
00097 gboolean is_int;
00098 int min;
00099 int max;
00100 gboolean secret;
00101 };
00102
00106 struct _PurpleAttentionType
00107 {
00108 const char *name;
00109 const char *incoming_description;
00110 const char *outgoing_description;
00111 const char *icon_name;
00112 const char *unlocalized_name;
00114
00115 gpointer _reserved2;
00116 gpointer _reserved3;
00117 gpointer _reserved4;
00118 };
00119
00125 typedef enum
00126 {
00134 OPT_PROTO_UNIQUE_CHATNAME = 0x00000004,
00135
00141 OPT_PROTO_CHAT_TOPIC = 0x00000008,
00142
00149 OPT_PROTO_NO_PASSWORD = 0x00000010,
00150
00156 OPT_PROTO_MAIL_CHECK = 0x00000020,
00157
00163 OPT_PROTO_IM_IMAGE = 0x00000040,
00164
00171 OPT_PROTO_PASSWORD_OPTIONAL = 0x00000080,
00172
00178 OPT_PROTO_USE_POINTSIZE = 0x00000100,
00179
00185 OPT_PROTO_REGISTER_NOSCREENNAME = 0x00000200,
00186
00192 OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400
00193
00194 } PurpleProtocolOptions;
00195
00203 struct _PurplePluginProtocolInfo
00204 {
00205 PurpleProtocolOptions options;
00207 GList *user_splits;
00208 GList *protocol_options;
00210 PurpleBuddyIconSpec icon_spec;
00220 const char *(*list_icon)(PurpleAccount *account, PurpleBuddy *buddy);
00221
00226 const char *(*list_emblem)(PurpleBuddy *buddy);
00227
00232 char *(*status_text)(PurpleBuddy *buddy);
00233
00237 void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full);
00238
00244 GList *(*status_types)(PurpleAccount *account);
00245
00251 GList *(*blist_node_menu)(PurpleBlistNode *node);
00252 GList *(*chat_info)(PurpleConnection *);
00253 GHashTable *(*chat_info_defaults)(PurpleConnection *, const char *chat_name);
00254
00255
00256
00258 void (*login)(PurpleAccount *);
00259
00261 void (*close)(PurpleConnection *);
00262
00272 int (*send_im)(PurpleConnection *, const char *who,
00273 const char *message,
00274 PurpleMessageFlags flags);
00275
00276 void (*set_info)(PurpleConnection *, const char *info);
00277
00285 unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleTypingState state);
00286
00291 void (*get_info)(PurpleConnection *, const char *who);
00292 void (*set_status)(PurpleAccount *account, PurpleStatus *status);
00293
00294 void (*set_idle)(PurpleConnection *, int idletime);
00295 void (*change_passwd)(PurpleConnection *, const char *old_pass,
00296 const char *new_pass);
00297 void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
00298 void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups);
00299 void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
00300 void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups);
00301 void (*add_permit)(PurpleConnection *, const char *name);
00302 void (*add_deny)(PurpleConnection *, const char *name);
00303 void (*rem_permit)(PurpleConnection *, const char *name);
00304 void (*rem_deny)(PurpleConnection *, const char *name);
00305 void (*set_permit_deny)(PurpleConnection *);
00306 void (*join_chat)(PurpleConnection *, GHashTable *components);
00307 void (*reject_chat)(PurpleConnection *, GHashTable *components);
00308 char *(*get_chat_name)(GHashTable *components);
00309 void (*chat_invite)(PurpleConnection *, int id,
00310 const char *message, const char *who);
00311 void (*chat_leave)(PurpleConnection *, int id);
00312 void (*chat_whisper)(PurpleConnection *, int id,
00313 const char *who, const char *message);
00314 int (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags);
00315
00322 void (*keepalive)(PurpleConnection *);
00323
00325 void (*register_user)(PurpleAccount *);
00326
00330 void (*get_cb_info)(PurpleConnection *, int, const char *who);
00335 void (*get_cb_away)(PurpleConnection *, int, const char *who);
00336
00338 void (*alias_buddy)(PurpleConnection *, const char *who,
00339 const char *alias);
00340
00342 void (*group_buddy)(PurpleConnection *, const char *who,
00343 const char *old_group, const char *new_group);
00344
00346 void (*rename_group)(PurpleConnection *, const char *old_name,
00347 PurpleGroup *group, GList *moved_buddies);
00348
00349 void (*buddy_free)(PurpleBuddy *);
00350
00351 void (*convo_closed)(PurpleConnection *, const char *who);
00352
00358 const char *(*normalize)(const PurpleAccount *, const char *who);
00359
00365 void (*set_buddy_icon)(PurpleConnection *, PurpleStoredImage *img);
00366
00367 void (*remove_group)(PurpleConnection *gc, PurpleGroup *group);
00368
00378 char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who);
00379
00380 void (*set_chat_topic)(PurpleConnection *gc, int id, const char *topic);
00381
00382 PurpleChat *(*find_blist_chat)(PurpleAccount *account, const char *name);
00383
00384
00385 PurpleRoomlist *(*roomlist_get_list)(PurpleConnection *gc);
00386 void (*roomlist_cancel)(PurpleRoomlist *list);
00387 void (*roomlist_expand_category)(PurpleRoomlist *list, PurpleRoomlistRoom *category);
00388
00389
00390 gboolean (*can_receive_file)(PurpleConnection *, const char *who);
00391 void (*send_file)(PurpleConnection *, const char *who, const char *filename);
00392 PurpleXfer *(*new_xfer)(PurpleConnection *, const char *who);
00393
00398 gboolean (*offline_message)(const PurpleBuddy *buddy);
00399
00400 PurpleWhiteboardPrplOps *whiteboard_prpl_ops;
00401
00403 int (*send_raw)(PurpleConnection *gc, const char *buf, int len);
00404
00405
00406 char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room);
00407
00412
00413
00414
00415 void (*unregister_user)(PurpleAccount *, PurpleAccountUnregistrationCb cb, void *user_data);
00416
00417
00418 gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type);
00419 GList *(*get_attention_types)(PurpleAccount *acct);
00420
00425 unsigned long struct_size;
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00451 GHashTable *(*get_account_text_table)(PurpleAccount *account);
00452 };
00453
00454 #define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \
00455 (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \
00456 || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \
00457 prpl->member != NULL)
00458
00459
00460 #define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \
00461 ((plugin)->info->type == PURPLE_PLUGIN_PROTOCOL)
00462
00463 #define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \
00464 ((PurplePluginProtocolInfo *)(plugin)->info->extra_info)
00465
00466 #ifdef __cplusplus
00467 extern "C" {
00468 #endif
00469
00470
00472
00488 PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name,
00489 const char *inc_desc, const char *out_desc);
00490
00500 void purple_attention_type_set_name(PurpleAttentionType *type, const char *name);
00501
00510 void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc);
00511
00520 void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc);
00521
00530 void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name);
00531
00541 void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname);
00542
00550 const char *purple_attention_type_get_name(const PurpleAttentionType *type);
00551
00559 const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type);
00560
00568 const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type);
00569
00578 const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type);
00579
00587 const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type);
00588
00591
00593
00605 void purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle,
00606 time_t idle_time);
00607
00616 void purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time);
00617
00628 void purple_prpl_got_account_status(PurpleAccount *account,
00629 const char *status_id, ...) G_GNUC_NULL_TERMINATED;
00643 void purple_prpl_got_user_idle(PurpleAccount *account, const char *name,
00644 gboolean idle, time_t idle_time);
00645
00655 void purple_prpl_got_user_login_time(PurpleAccount *account, const char *name,
00656 time_t login_time);
00657
00669 void purple_prpl_got_user_status(PurpleAccount *account, const char *name,
00670 const char *status_id, ...) G_GNUC_NULL_TERMINATED;
00671
00681 void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name,
00682 const char *status_id);
00683
00692 void purple_prpl_change_account_status(PurpleAccount *account,
00693 PurpleStatus *old_status,
00694 PurpleStatus *new_status);
00695
00704 GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence);
00705
00718 void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code);
00719
00728 void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code);
00729
00739 void purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code);
00740
00743
00745
00753 PurplePlugin *purple_find_prpl(const char *id);
00754
00757 #ifdef __cplusplus
00758 }
00759 #endif
00760
00761 #endif