Ignore:
Timestamp:
2010-10-02T05:34:53Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2af3e23
Parents:
05bf2a0 (diff), 04cd284 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging msnp13 branch which, confusingly, upgrades the msn module to use
MSNP15. (The reason for this is that A) IMHO MSNP13 is what causes most of
the pain in this upgade and B) I initially intended to only implement MSNP13
but then discovered MS doesn't support it anymore.)

This fixes issues with display names being forgotten, adding contacts (and
them automatically getting blocked sometimes!!), and adds support for
away/status messages and some support for sending offline messages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.h

    r05bf2a0 r62f53b50  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2010 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    3939#endif
    4040
    41 #define QRY_NAME "msmsgs@msnmsgr.com"
    42 #define QRY_CODE "Q1P7W2E4J9R8U3S5"
     41/* This should be MSN Messenger 7.0.0813
     42#define MSNP11_PROD_KEY "CFHUR$52U_{VIX5T"
     43#define MSNP11_PROD_ID  "PROD0101{0RM?UBW"
     44*/
     45
     46#define MSN_NS_HOST "messenger.hotmail.com"
     47#define MSN_NS_PORT 1863
     48
     49/* Some other version.
     50#define MSNP11_PROD_KEY "O4BG@C7BWLYQX?5G"
     51#define MSNP11_PROD_ID  "PROD01065C%ZFN6F"
     52*/
     53
     54#define MSNP11_PROD_KEY "ILTXC!4IXB5FB*PX"
     55#define MSNP11_PROD_ID  "PROD0119GSJUC$18"
     56#define MSNP_VER        "MSNP15"
     57#define MSNP_BUILD      "8.5.1288"
    4358
    4459#define MSN_SB_NEW         -24062002
     
    6176#define PROFILE_URL "http://members.msn.com/"
    6277
     78typedef enum
     79{
     80        MSN_GOT_PROFILE = 1,
     81        MSN_GOT_PROFILE_DN = 2,
     82        MSN_DONE_ADL = 4,
     83        MSN_REAUTHING = 8,
     84} msn_flags_t;
     85
     86struct msn_handler_data
     87{
     88        int fd, inpa;
     89        int rxlen;
     90        char *rxq;
     91       
     92        int msglen;
     93        char *cmd_text;
     94       
     95        /* Either ic or sb */
     96        gpointer data;
     97       
     98        int (*exec_command) ( struct msn_handler_data *handler, char **cmd, int count );
     99        int (*exec_message) ( struct msn_handler_data *handler, char *msg, int msglen, char **cmd, int count );
     100};
     101
    63102struct msn_data
    64103{
    65104        struct im_connection *ic;
    66105       
    67         int fd;
    68         struct msn_handler_data *handler;
     106        struct msn_handler_data ns[1];
     107        msn_flags_t flags;
    69108       
    70109        int trId;
    71        
    72         GSList *msgq, *grpq;
     110        char *tokens[4];
     111        char *lock_key, *pp_policy;
     112       
     113        GSList *msgq, *grpq, *soapq;
    73114        GSList *switchboards;
    74115        int sb_failures;
    75116        time_t first_sb_failure;
    76         GSList *filetransfers;
    77117       
    78118        const struct msn_away_state *away_state;
    79         int buddycount;
    80         int groupcount;
    81         char **grouplist;
     119        GSList *groups;
     120       
     121        /* Mostly used for sending the ADL command; since MSNP13 the client
     122           is responsible for downloading the contact list and then sending
     123           it to the MSNP server. */
     124        GTree *domaintree;
     125        int adl_todo;
    82126};
    83127
     
    86130        struct im_connection *ic;
    87131       
     132        /* The following two are also in the handler. TODO: Clean up. */
    88133        int fd;
    89134        gint inp;
     
    127172};
    128173
    129 struct msn_handler_data
    130 {
    131         int fd;
    132         int rxlen;
    133         char *rxq;
    134        
    135         int msglen;
    136         char *cmd_text;
    137        
    138         gpointer data;
    139        
    140         int (*exec_command) ( gpointer data, char **cmd, int count );
    141         int (*exec_message) ( gpointer data, char *msg, int msglen, char **cmd, int count );
     174typedef enum
     175{
     176        MSN_BUDDY_FL = 1,   /* Warning: FL,AL,BL *must* be 1,2,4. */
     177        MSN_BUDDY_AL = 2,
     178        MSN_BUDDY_BL = 4,
     179        MSN_BUDDY_RL = 8,
     180        MSN_BUDDY_PL = 16,
     181        MSN_BUDDY_ADL_SYNCED = 256,
     182} msn_buddy_flags_t;
     183
     184struct msn_buddy_data
     185{
     186        char *cid;
     187        msn_buddy_flags_t flags;
     188};
     189
     190struct msn_group
     191{
     192        char *name;
     193        char *id;
    142194};
    143195
     
    161213
    162214/* ns.c */
    163 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
     215int msn_ns_write( struct im_connection *ic, int fd, const char *fmt, ... );
     216gboolean msn_ns_connect( struct im_connection *ic, struct msn_handler_data *handler, const char *host, int port );
     217void msn_ns_close( struct msn_handler_data *handler );
     218void msn_auth_got_passport_token( struct im_connection *ic, const char *token, const char *error );
     219void msn_auth_got_contact_list( struct im_connection *ic );
     220int msn_ns_finish_login( struct im_connection *ic );
    164221
    165222/* msn_util.c */
    166 int msn_write( struct im_connection *ic, char *s, int len );
    167223int msn_logged_in( struct im_connection *ic );
    168 int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group );
    169 int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group );
    170 void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
     224int msn_buddy_list_add( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *realname_, const char *group );
     225int msn_buddy_list_remove( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group );
     226void msn_buddy_ask( bee_user_t *bu );
    171227char *msn_findheader( char *text, char *header, int len );
    172228char **msn_linesplit( char *line );
    173229int msn_handler( struct msn_handler_data *h );
    174 char *msn_http_encode( const char *input );
    175230void msn_msgq_purge( struct im_connection *ic, GSList **list );
    176 gboolean msn_set_display_name( struct im_connection *ic, const char *rawname );
     231char *msn_p11_challenge( char *challenge );
     232gint msn_domaintree_cmp( gconstpointer a_, gconstpointer b_ );
     233struct msn_group *msn_group_by_name( struct im_connection *ic, const char *name );
     234struct msn_group *msn_group_by_id( struct im_connection *ic, const char *id );
     235int msn_ns_set_display_name( struct im_connection *ic, const char *value );
    177236
    178237/* tables.c */
     
    183242
    184243/* sb.c */
    185 int msn_sb_write( struct msn_switchboard *sb, char *s, int len );
     244int msn_sb_write( struct msn_switchboard *sb, const char *fmt, ... );
    186245struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
    187246struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
     
    196255void msn_sb_stop_keepalives( struct msn_switchboard *sb );
    197256
    198 /* invitation.c */
    199 void msn_ftp_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );
    200 
    201257#endif //_MSN_H
Note: See TracChangeset for help on using the changeset viewer.