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/msn/msn.h

    raf359b4 r5ebff60  
    1   /********************************************************************\
     1/********************************************************************\
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
     
    3535
    3636#ifdef DEBUG_MSN
    37 #define debug( text... ) imcb_log( ic, text );
     37#define debug(text ...) imcb_log(ic, text);
    3838#else
    39 #define debug( text... )
     39#define debug(text ...)
    4040#endif
    4141
     
    6969
    7070#define MSN_MESSAGE_HEADERS "MIME-Version: 1.0\r\n" \
    71                             "Content-Type: text/plain; charset=UTF-8\r\n" \
    72                             "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
    73                             "X-MMS-IM-Format: FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0\r\n" \
    74                             "\r\n"
     71        "Content-Type: text/plain; charset=UTF-8\r\n" \
     72        "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
     73        "X-MMS-IM-Format: FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0\r\n" \
     74        "\r\n"
    7575
    7676#define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \
    77                            "Content-Type: text/x-msmsgscontrol\r\n" \
    78                            "TypingUser: %s\r\n" \
    79                            "\r\n\r\n"
     77        "Content-Type: text/x-msmsgscontrol\r\n" \
     78        "TypingUser: %s\r\n" \
     79        "\r\n\r\n"
    8080
    8181#define MSN_NUDGE_HEADERS "MIME-Version: 1.0\r\n" \
    82                           "Content-Type: text/x-msnmsgr-datacast\r\n" \
    83                           "\r\n" \
    84                           "ID: 1\r\n" \
    85                           "\r\n"
     82        "Content-Type: text/x-msnmsgr-datacast\r\n" \
     83        "\r\n" \
     84        "ID: 1\r\n" \
     85        "\r\n"
    8686
    8787#define MSN_SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \
    88                                  "Content-Type: text/x-ping\r\n" \
    89                                  "\r\n\r\n"
     88        "Content-Type: text/x-ping\r\n" \
     89        "\r\n\r\n"
    9090
    9191#define PROFILE_URL "http://members.msn.com/"
    9292
    93 typedef enum
    94 {
     93typedef enum {
    9594        MSN_GOT_PROFILE = 1,
    9695        MSN_GOT_PROFILE_DN = 2,
     
    10099} msn_flags_t;
    101100
    102 struct msn_handler_data
    103 {
     101struct msn_handler_data {
    104102        int fd, inpa;
    105103        int rxlen;
    106104        char *rxq;
    107        
     105
    108106        int msglen;
    109107        char *cmd_text;
    110        
     108
    111109        /* Either ic or sb */
    112110        gpointer data;
    113        
    114         int (*exec_command) ( struct msn_handler_data *handler, char **cmd, int count );
    115         int (*exec_message) ( struct msn_handler_data *handler, char *msg, int msglen, char **cmd, int count );
    116 };
    117 
    118 struct msn_data
    119 {
     111
     112        int (*exec_command) (struct msn_handler_data *handler, char **cmd, int count);
     113        int (*exec_message) (struct msn_handler_data *handler, char *msg, int msglen, char **cmd, int count);
     114};
     115
     116struct msn_data {
    120117        struct im_connection *ic;
    121        
     118
    122119        struct msn_handler_data ns[1];
    123120        msn_flags_t flags;
    124        
     121
    125122        int trId;
    126123        char *tokens[4];
    127124        char *lock_key, *pp_policy;
    128125        char *uuid;
    129        
     126
    130127        GSList *msgq, *grpq, *soapq;
    131128        GSList *switchboards;
    132129        int sb_failures;
    133130        time_t first_sb_failure;
    134        
     131
    135132        const struct msn_away_state *away_state;
    136133        GSList *groups;
    137134        char *profile_rid;
    138        
     135
    139136        /* Mostly used for sending the ADL command; since MSNP13 the client
    140137           is responsible for downloading the contact list and then sending
     
    144141};
    145142
    146 struct msn_switchboard
    147 {
     143struct msn_switchboard {
    148144        struct im_connection *ic;
    149        
     145
    150146        /* The following two are also in the handler. TODO: Clean up. */
    151147        int fd;
     
    153149        struct msn_handler_data *handler;
    154150        gint keepalive;
    155        
     151
    156152        int trId;
    157153        int ready;
    158        
     154
    159155        int session;
    160156        char *key;
    161        
     157
    162158        GSList *msgq;
    163159        char *who;
     
    165161};
    166162
    167 struct msn_away_state
    168 {
     163struct msn_away_state {
    169164        char code[4];
    170165        char name[16];
    171166};
    172167
    173 struct msn_status_code
    174 {
     168struct msn_status_code {
    175169        int number;
    176170        char *text;
     
    178172};
    179173
    180 struct msn_message
    181 {
     174struct msn_message {
    182175        char *who;
    183176        char *text;
    184177};
    185178
    186 struct msn_groupadd
    187 {
     179struct msn_groupadd {
    188180        char *who;
    189181        char *group;
    190182};
    191183
    192 typedef enum
    193 {
     184typedef enum {
    194185        MSN_BUDDY_FL = 1,   /* Warning: FL,AL,BL *must* be 1,2,4. */
    195186        MSN_BUDDY_AL = 2,
     
    201192} msn_buddy_flags_t;
    202193
    203 struct msn_buddy_data
    204 {
     194struct msn_buddy_data {
    205195        char *cid;
    206196        msn_buddy_flags_t flags;
    207197};
    208198
    209 struct msn_group
    210 {
     199struct msn_group {
    211200        char *name;
    212201        char *id;
     
    216205#define STATUS_FATAL            1
    217206#define STATUS_SB_FATAL         2
    218 #define STATUS_SB_IM_SPARE      4       /* Make one-to-one conversation switchboard available again, invite failed. */
    219 #define STATUS_SB_CHAT_SPARE    8       /* Same, but also for groupchats (not used yet). */
     207#define STATUS_SB_IM_SPARE      4       /* Make one-to-one conversation switchboard available again, invite failed. */
     208#define STATUS_SB_CHAT_SPARE    8       /* Same, but also for groupchats (not used yet). */
    220209
    221210extern int msn_chat_id;
     
    232221
    233222/* ns.c */
    234 int msn_ns_write( struct im_connection *ic, int fd, const char *fmt, ... ) G_GNUC_PRINTF( 3, 4 );
    235 gboolean msn_ns_connect( struct im_connection *ic, struct msn_handler_data *handler, const char *host, int port );
    236 void msn_ns_close( struct msn_handler_data *handler );
    237 void msn_auth_got_passport_token( struct im_connection *ic, const char *token, const char *error );
    238 void msn_auth_got_contact_list( struct im_connection *ic );
    239 int msn_ns_finish_login( struct im_connection *ic );
    240 int msn_ns_sendmessage( struct im_connection *ic, struct bee_user *bu, const char *text );
    241 void msn_ns_oim_send_queue( struct im_connection *ic, GSList **msgq );
     223int msn_ns_write(struct im_connection *ic, int fd, const char *fmt, ...) G_GNUC_PRINTF(3, 4);
     224gboolean msn_ns_connect(struct im_connection *ic, struct msn_handler_data *handler, const char *host, int port);
     225void msn_ns_close(struct msn_handler_data *handler);
     226void msn_auth_got_passport_token(struct im_connection *ic, const char *token, const char *error);
     227void msn_auth_got_contact_list(struct im_connection *ic);
     228int msn_ns_finish_login(struct im_connection *ic);
     229int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text);
     230void msn_ns_oim_send_queue(struct im_connection *ic, GSList **msgq);
    242231
    243232/* msn_util.c */
    244 int msn_buddy_list_add( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *realname_, const char *group );
    245 int msn_buddy_list_remove( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group );
    246 void msn_buddy_ask( bee_user_t *bu );
    247 char **msn_linesplit( char *line );
    248 int msn_handler( struct msn_handler_data *h );
    249 void msn_msgq_purge( struct im_connection *ic, GSList **list );
    250 char *msn_p11_challenge( char *challenge );
    251 gint msn_domaintree_cmp( gconstpointer a_, gconstpointer b_ );
    252 struct msn_group *msn_group_by_name( struct im_connection *ic, const char *name );
    253 struct msn_group *msn_group_by_id( struct im_connection *ic, const char *id );
    254 int msn_ns_set_display_name( struct im_connection *ic, const char *value );
    255 const char *msn_normalize_handle( const char *handle );
     233int msn_buddy_list_add(struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *realname_,
     234                       const char *group);
     235int msn_buddy_list_remove(struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group);
     236void msn_buddy_ask(bee_user_t *bu);
     237char **msn_linesplit(char *line);
     238int msn_handler(struct msn_handler_data *h);
     239void msn_msgq_purge(struct im_connection *ic, GSList **list);
     240char *msn_p11_challenge(char *challenge);
     241gint msn_domaintree_cmp(gconstpointer a_, gconstpointer b_);
     242struct msn_group *msn_group_by_name(struct im_connection *ic, const char *name);
     243struct msn_group *msn_group_by_id(struct im_connection *ic, const char *id);
     244int msn_ns_set_display_name(struct im_connection *ic, const char *value);
     245const char *msn_normalize_handle(const char *handle);
    256246
    257247/* tables.c */
    258 const struct msn_away_state *msn_away_state_by_number( int number );
    259 const struct msn_away_state *msn_away_state_by_code( char *code );
    260 const struct msn_away_state *msn_away_state_by_name( char *name );
    261 const struct msn_status_code *msn_status_by_number( int number );
     248const struct msn_away_state *msn_away_state_by_number(int number);
     249const struct msn_away_state *msn_away_state_by_code(char *code);
     250const struct msn_away_state *msn_away_state_by_name(char *name);
     251const struct msn_status_code *msn_status_by_number(int number);
    262252
    263253/* sb.c */
    264 int msn_sb_write( struct msn_switchboard *sb, const char *fmt, ... ) G_GNUC_PRINTF( 2, 3 );;
    265 struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
    266 struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, const char *handle );
    267 struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
    268 struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
    269 int msn_sb_sendmessage( struct msn_switchboard *sb, char *text );
    270 struct groupchat *msn_sb_to_chat( struct msn_switchboard *sb );
    271 void msn_sb_destroy( struct msn_switchboard *sb );
    272 gboolean msn_sb_connected( gpointer data, gint source, b_input_condition cond );
    273 int msn_sb_write_msg( struct im_connection *ic, struct msn_message *m );
    274 void msn_sb_start_keepalives( struct msn_switchboard *sb, gboolean initial );
    275 void msn_sb_stop_keepalives( struct msn_switchboard *sb );
     254int msn_sb_write(struct msn_switchboard *sb, const char *fmt, ...) G_GNUC_PRINTF(2, 3);;
     255struct msn_switchboard *msn_sb_create(struct im_connection *ic, char *host, int port, char *key, int session);
     256struct msn_switchboard *msn_sb_by_handle(struct im_connection *ic, const char *handle);
     257struct msn_switchboard *msn_sb_by_chat(struct groupchat *c);
     258struct msn_switchboard *msn_sb_spare(struct im_connection *ic);
     259int msn_sb_sendmessage(struct msn_switchboard *sb, char *text);
     260struct groupchat *msn_sb_to_chat(struct msn_switchboard *sb);
     261void msn_sb_destroy(struct msn_switchboard *sb);
     262gboolean msn_sb_connected(gpointer data, gint source, b_input_condition cond);
     263int msn_sb_write_msg(struct im_connection *ic, struct msn_message *m);
     264void msn_sb_start_keepalives(struct msn_switchboard *sb, gboolean initial);
     265void msn_sb_stop_keepalives(struct msn_switchboard *sb);
    276266
    277267#endif //_MSN_H
Note: See TracChangeset for help on using the changeset viewer.