Changeset 5ebff60 for protocols/nogaim.h


Ignore:
Timestamp:
2015-02-20T22:50:54Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
0b9daac, 3d45471, 7733b8c
Parents:
af359b4
git-author:
Indent <please@…> (19-02-15 05:47:20)
git-committer:
dequis <dx@…> (20-02-15 22:50:54)
Message:

Reindent everything to K&R style with tabs

Used uncrustify, with the configuration file in ./doc/uncrustify.cfg

Commit author set to "Indent <please@…>" so that it's easier to
skip while doing git blame.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.h

    raf359b4 r5ebff60  
    1   /********************************************************************\
     1/********************************************************************\
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
     
    3939#define _NOGAIM_H
    4040
    41 #if(__sun)
     41#if (__sun)
    4242#include <inttypes.h>
    4343#else
     
    7272
    7373/* ok. now the fun begins. first we create a connection structure */
    74 struct im_connection
    75 {
     74struct im_connection {
    7675        account_t *acc;
    7776        uint32_t flags;
    78        
     77
    7978        /* each connection then can have its own protocol-specific data */
    8079        void *proto_data;
    81        
     80
    8281        /* all connections need an input watcher */
    8382        int inpa;
    8483        guint keepalive;
    85        
     84
    8685        /* buddy list stuff. there is still a global groups for the buddy list, but
    8786         * we need to maintain our own set of buddies, and our own permit/deny lists */
     
    8988        GSList *deny;
    9089        int permdeny;
    91        
     90
    9291        char *away;
    93        
     92
    9493        /* BitlBee */
    9594        bee_t *bee;
    96        
     95
    9796        GSList *groupchats;
    9897};
     
    107106        GList *in_room;
    108107        //GList *ignored;
    109        
     108
    110109        //struct groupchat *next;
    111110        /* The title variable contains the ID you gave when you created the
     
    153152         * it should be used for anything else. You are supposed to use the
    154153         * set_add() function to add new settings. */
    155         void (* init)           (account_t *);
     154        void (* init)           (account_t *);
    156155        /* The typical usage of the login() function:
    157156         * - Create an im_connection using imcb_new() from the account_t parameter.
     
    160159         * - Use proxy_connect() to connect to the server.
    161160         */
    162         void (* login)          (account_t *);
     161        void (* login)          (account_t *);
    163162        /* Implementing this function is optional. */
    164         void (* keepalive)      (struct im_connection *);
     163        void (* keepalive)      (struct im_connection *);
    165164        /* In this function you should:
    166165         * - Tell the server about you are logging out.
     
    168167         *   properly do so.
    169168         */
    170         void (* logout)         (struct im_connection *);
    171        
     169        void (* logout)         (struct im_connection *);
     170
    172171        /* This function is called when the user wants to send a message to a handle.
    173172         * - 'to' is a handle, not a nick
    174173         * - 'flags' may be ignored
    175174         */
    176         int  (* buddy_msg)      (struct im_connection *, char *to, char *message, int flags);
     175        int (* buddy_msg)      (struct im_connection *, char *to, char *message, int flags);
    177176        /* This function is called then the user uses the /away IRC command.
    178177         * - 'state' contains the away reason.
    179178         * - 'message' may be ignored if your protocol does not support it.
    180179         */
    181         void (* set_away)       (struct im_connection *, char *state, char *message);
     180        void (* set_away)       (struct im_connection *, char *state, char *message);
    182181        /* Implementing this function is optional. */
    183182        void (* get_away)       (struct im_connection *, char *who);
    184183        /* Implementing this function is optional. */
    185         int  (* send_typing)    (struct im_connection *, char *who, int flags);
    186        
     184        int (* send_typing)    (struct im_connection *, char *who, int flags);
     185
    187186        /* 'name' is a handle to add/remove. For now BitlBee doesn't really
    188187         * handle groups, just set it to NULL, so you can ignore that
    189188         * parameter. */
    190         void (* add_buddy)      (struct im_connection *, char *name, char *group);
    191         void (* remove_buddy)   (struct im_connection *, char *name, char *group);
    192        
     189        void (* add_buddy)      (struct im_connection *, char *name, char *group);
     190        void (* remove_buddy)   (struct im_connection *, char *name, char *group);
     191
    193192        /* Block list stuff. Implementing these are optional. */
    194         void (* add_permit)     (struct im_connection *, char *who);
    195         void (* add_deny)       (struct im_connection *, char *who);
    196         void (* rem_permit)     (struct im_connection *, char *who);
    197         void (* rem_deny)       (struct im_connection *, char *who);
     193        void (* add_permit)     (struct im_connection *, char *who);
     194        void (* add_deny)       (struct im_connection *, char *who);
     195        void (* rem_permit)     (struct im_connection *, char *who);
     196        void (* rem_deny)       (struct im_connection *, char *who);
    198197        /* Doesn't actually have UI hooks. Not used at all, can be removed. */
    199198        void (* set_permit_deny)(struct im_connection *);
    200        
     199
    201200        /* Request profile info. Free-formatted stuff, the IM module gives back
    202201           this info via imcb_log(). Implementing these are optional. */
    203         void (* get_info)       (struct im_connection *, char *who);
     202        void (* get_info)       (struct im_connection *, char *who);
    204203        /* set_my_name is *DEPRECATED*, not used by the UI anymore. Use the
    205204           display_name setting instead. */
    206         void (* set_my_name)    (struct im_connection *, char *name);
    207         void (* set_name)       (struct im_connection *, char *who, char *name);
    208        
     205        void (* set_my_name)    (struct im_connection *, char *name);
     206        void (* set_name)       (struct im_connection *, char *who, char *name);
     207
    209208        /* Group chat stuff. */
    210209        /* This is called when the user uses the /invite IRC command.
     
    212211         * - 'message' is a handle to invite
    213212         */
    214         void (* chat_invite)    (struct groupchat *, char *who, char *message);
     213        void (* chat_invite)    (struct groupchat *, char *who, char *message);
    215214        /* This is called when the user uses the /kick IRC command.
    216215         * - 'who' is a handle to kick
    217216         * - 'message' is a kick message or NULL
    218217         */
    219         void (* chat_kick)      (struct groupchat *, char *who, const char *message);
     218        void (* chat_kick)      (struct groupchat *, char *who, const char *message);
    220219        /* This is called when the user uses the /part IRC command in a group
    221220         * chat. You just should tell the user about it, nothing more. */
    222         void (* chat_leave)     (struct groupchat *);
     221        void (* chat_leave)     (struct groupchat *);
    223222        /* This is called when the user sends a message to the groupchat.
    224223         * 'flags' may be ignored. */
    225         void (* chat_msg)       (struct groupchat *, char *message, int flags);
     224        void (* chat_msg)       (struct groupchat *, char *message, int flags);
    226225        /* This is called when the user uses the /join #nick IRC command.
    227226         * - 'who' is the handle of the nick
    228227         */
    229228        struct groupchat *
    230              (* chat_with)      (struct im_connection *, char *who);
     229        (* chat_with)      (struct im_connection *, char *who);
    231230        /* This is used when the user uses the /join #channel IRC command.  If
    232231         * your protocol does not support publicly named group chats, then do
    233232         * not implement this. */
    234233        struct groupchat *
    235              (* chat_join)      (struct im_connection *, const char *room,
    236                                  const char *nick, const char *password, set_t **sets);
     234        (* chat_join)      (struct im_connection *, const char *room,
     235                            const char *nick, const char *password, set_t **sets);
    237236        /* Change the topic, if supported. Note that BitlBee expects the IM
    238237           server to confirm the topic change with a regular topic change
    239238           event. If it doesn't do that, you have to fake it to make it
    240239           visible to the user. */
    241         void (* chat_topic)     (struct groupchat *, char *topic);
    242        
     240        void (* chat_topic)     (struct groupchat *, char *topic);
     241
    243242        /* If your protocol module needs any special info for joining chatrooms
    244243           other than a roomname + nickname, add them here. */
    245         void (* chat_add_settings)      (account_t *acc, set_t **head);
    246         void (* chat_free_settings)     (account_t *acc, set_t **head);
    247        
     244        void (* chat_add_settings)      (account_t *acc, set_t **head);
     245        void (* chat_free_settings)     (account_t *acc, set_t **head);
     246
    248247        /* You can tell what away states your protocol supports, so that
    249248         * BitlBee will try to map the IRC away reasons to them. If your
    250249         * protocol doesn't have any, just return one generic "Away". */
    251250        GList *(* away_states)(struct im_connection *ic);
    252        
     251
    253252        /* Mainly for AOL, since they think "Bung hole" == "Bu ngho le". *sigh*
    254253         * - Most protocols will just want to set this to g_strcasecmp().*/
     
    256255
    257256        /* Implement these callbacks if you want to use imcb_ask_auth() */
    258         void (* auth_allow)     (struct im_connection *, const char *who);
    259         void (* auth_deny)      (struct im_connection *, const char *who);
     257        void (* auth_allow)     (struct im_connection *, const char *who);
     258        void (* auth_deny)      (struct im_connection *, const char *who);
    260259
    261260        /* Incoming transfer request */
    262         void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle );
    263        
     261        void (* transfer_request) (struct im_connection *, file_transfer_t *ft, char *handle);
     262
    264263        void (* buddy_data_add) (struct bee_user *bu);
    265264        void (* buddy_data_free) (struct bee_user *bu);
    266        
     265
    267266        GList *(* buddy_action_list) (struct bee_user *bu);
    268267        void *(* buddy_action) (struct bee_user *bu, const char *action, char * const args[], void *data);
    269        
     268
    270269        /* If null, equivalent to handle_cmp( ic->acc->user, who ) */
    271270        gboolean (* handle_is_self) (struct im_connection *, const char *who);
     
    282281void nogaim_init();
    283282G_MODULE_EXPORT GSList *get_connections();
    284 G_MODULE_EXPORT struct prpl *find_protocol( const char *name );
     283G_MODULE_EXPORT struct prpl *find_protocol(const char *name);
    285284/* When registering a new protocol, you should allocate space for a new prpl
    286285 * struct, initialize it (set the function pointers to point to your
    287286 * functions), finally call this function. */
    288 G_MODULE_EXPORT void register_protocol( struct prpl * );
     287G_MODULE_EXPORT void register_protocol(struct prpl *);
    289288
    290289/* Connection management. */
    291290/* You will need this function in prpl->login() to get an im_connection from
    292291 * the account_t parameter. */
    293 G_MODULE_EXPORT struct im_connection *imcb_new( account_t *acc );
    294 G_MODULE_EXPORT void imc_free( struct im_connection *ic );
     292G_MODULE_EXPORT struct im_connection *imcb_new(account_t *acc);
     293G_MODULE_EXPORT void imc_free(struct im_connection *ic);
    295294/* Once you're connected, you should call this function, so that the user will
    296295 * see the success. */
    297 G_MODULE_EXPORT void imcb_connected( struct im_connection *ic );
     296G_MODULE_EXPORT void imcb_connected(struct im_connection *ic);
    298297/* This can be used to disconnect when something went wrong (ie. read error
    299298 * from the server). You probably want to set the second parameter to TRUE. */
    300 G_MODULE_EXPORT void imc_logout( struct im_connection *ic, int allow_reconnect );
     299G_MODULE_EXPORT void imc_logout(struct im_connection *ic, int allow_reconnect);
    301300
    302301/* Communicating with the user. */
    303302/* A printf()-like function to tell the user anything you want. */
    304 G_MODULE_EXPORT void imcb_log( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
     303G_MODULE_EXPORT void imcb_log(struct im_connection *ic, char *format, ...) G_GNUC_PRINTF(2, 3);
    305304/* To tell the user an error, ie. before logging out when an error occurs. */
    306 G_MODULE_EXPORT void imcb_error( struct im_connection *ic, char *format, ... ) G_GNUC_PRINTF( 2, 3 );
     305G_MODULE_EXPORT void imcb_error(struct im_connection *ic, char *format, ...) G_GNUC_PRINTF(2, 3);
    307306
    308307/* To ask a your about something.
     
    311310 * - 'doit' or 'dont' will be called depending of the answer of the user.
    312311 */
    313 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont );
    314 G_MODULE_EXPORT void imcb_ask_with_free( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont, query_callback myfree );
     312G_MODULE_EXPORT void imcb_ask(struct im_connection *ic, char *msg, void *data, query_callback doit,
     313                              query_callback dont);
     314G_MODULE_EXPORT void imcb_ask_with_free(struct im_connection *ic, char *msg, void *data, query_callback doit,
     315                                        query_callback dont, query_callback myfree);
    315316
    316317/* Two common questions you may want to ask:
     
    318319 * - X is not in your contact list, want to add?
    319320 */
    320 G_MODULE_EXPORT void imcb_ask_auth( struct im_connection *ic, const char *handle, const char *realname );
    321 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, const char *handle, const char *realname );
     321G_MODULE_EXPORT void imcb_ask_auth(struct im_connection *ic, const char *handle, const char *realname);
     322G_MODULE_EXPORT void imcb_ask_add(struct im_connection *ic, const char *handle, const char *realname);
    322323
    323324/* Buddy management */
     
    325326 * user, usually after a login, or if the user added a buddy and the IM
    326327 * server confirms that the add was successful. Don't forget to do this! */
    327 G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, const char *handle, const char *group );
    328 G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, const char *handle, char *group );
    329 G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle );
    330 G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname );
    331 G_MODULE_EXPORT void imcb_buddy_nick_hint( struct im_connection *ic, const char *handle, const char *nick );
    332 G_MODULE_EXPORT void imcb_buddy_action_response( bee_user_t *bu, const char *action, char * const args[], void *data );
    333 
    334 G_MODULE_EXPORT void imcb_buddy_typing( struct im_connection *ic, const char *handle, uint32_t flags );
    335 G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle( struct im_connection *ic, const char *handle );
    336 G_MODULE_EXPORT void imcb_clean_handle( struct im_connection *ic, char *handle );
     328G_MODULE_EXPORT void imcb_add_buddy(struct im_connection *ic, const char *handle, const char *group);
     329G_MODULE_EXPORT void imcb_remove_buddy(struct im_connection *ic, const char *handle, char *group);
     330G_MODULE_EXPORT struct buddy *imcb_find_buddy(struct im_connection *ic, char *handle);
     331G_MODULE_EXPORT void imcb_rename_buddy(struct im_connection *ic, const char *handle, const char *realname);
     332G_MODULE_EXPORT void imcb_buddy_nick_hint(struct im_connection *ic, const char *handle, const char *nick);
     333G_MODULE_EXPORT void imcb_buddy_action_response(bee_user_t *bu, const char *action, char * const args[], void *data);
     334
     335G_MODULE_EXPORT void imcb_buddy_typing(struct im_connection *ic, const char *handle, uint32_t flags);
     336G_MODULE_EXPORT struct bee_user *imcb_buddy_by_handle(struct im_connection *ic, const char *handle);
     337G_MODULE_EXPORT void imcb_clean_handle(struct im_connection *ic, char *handle);
    337338
    338339/* Actions, or whatever. */
    339 int imc_away_send_update( struct im_connection *ic );
    340 int imc_chat_msg( struct groupchat *c, char *msg, int flags );
    341 
    342 void imc_add_allow( struct im_connection *ic, char *handle );
    343 void imc_rem_allow( struct im_connection *ic, char *handle );
    344 void imc_add_block( struct im_connection *ic, char *handle );
    345 void imc_rem_block( struct im_connection *ic, char *handle );
     340int imc_away_send_update(struct im_connection *ic);
     341int imc_chat_msg(struct groupchat *c, char *msg, int flags);
     342
     343void imc_add_allow(struct im_connection *ic, char *handle);
     344void imc_rem_allow(struct im_connection *ic, char *handle);
     345void imc_add_block(struct im_connection *ic, char *handle);
     346void imc_rem_block(struct im_connection *ic, char *handle);
    346347
    347348/* Misc. stuff */
    348 char *set_eval_timezone( set_t *set, char *value );
    349 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond );
    350 void cancel_auto_reconnect( struct account *a );
     349char *set_eval_timezone(set_t *set, char *value);
     350gboolean auto_reconnect(gpointer data, gint fd, b_input_condition cond);
     351void cancel_auto_reconnect(struct account *a);
    351352
    352353#endif
Note: See TracChangeset for help on using the changeset viewer.