Ignore:
Timestamp:
2015-03-15T14:41:47Z (9 years ago)
Author:
dequis <dx@…>
Children:
6e74911
Parents:
3752019
git-author:
dequis <dx@…> (09-03-15 08:35:50)
git-committer:
dequis <dx@…> (15-03-15 14:41:47)
Message:

msn: removed switchboards, implemented SDG message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.h

    r3752019 rffa5b70  
    3232#define NUDGE_MESSAGE "\r\r\rSHAKE THAT THING\r\r\r"
    3333#define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r"
    34 #define SB_KEEPALIVE_MESSAGE "\r\r\rDONT HANG UP ON ME!\r\r\r"
    3534
    3635#ifdef DEBUG_MSN
     
    6867#define MSN_CAP2        0x0000
    6968
    70 #define MSN_MESSAGE_HEADERS "MIME-Version: 1.0\r\n" \
     69#define MSN_MESSAGE_HEADERS \
     70        "Routing: 1.0\r\n" \
     71        "To: 1:%s\r\n" \
     72        "From: 1:%s;epid={%s}\r\n" \
     73        "\r\n" \
     74        "Reliability: 1.0\r\n" \
     75        "\r\n" \
     76        "Messaging: 2.0\r\n" \
     77        "Message-Type: Text\r\n" \
     78        "Content-Length: %zd\r\n" \
    7179        "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"
     80        "X-MMS-IM-Format: FN=Segoe%%20UI; EF=; CO=0; CS=0; PF=0\r\n" \
     81        "\r\n" \
     82        "%s"
    7583
    7684#define MSN_TYPING_HEADERS "MIME-Version: 1.0\r\n" \
     
    8492        "ID: 1\r\n" \
    8593        "\r\n"
    86 
    87 #define MSN_SB_KEEPALIVE_HEADERS "MIME-Version: 1.0\r\n" \
    88         "Content-Type: text/x-ping\r\n" \
    89         "\r\n\r\n"
    9094
    9195#define PROFILE_URL "http://members.msn.com/"
     
    99103} msn_flags_t;
    100104
    101 struct msn_handler_data {
     105struct msn_data {
    102106        int fd, inpa;
    103107        int rxlen;
     
    107111        char *cmd_text;
    108112
    109         /* Either ic or sb */
    110         gpointer data;
    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 
    116 struct msn_data {
    117113        struct im_connection *ic;
    118114
    119         struct msn_handler_data ns[1];
    120115        msn_flags_t flags;
    121116
     
    126121
    127122        GSList *msgq, *grpq, *soapq;
    128         GSList *switchboards;
    129         int sb_failures;
    130         time_t first_sb_failure;
    131123
    132124        const struct msn_away_state *away_state;
     
    139131        GTree *domaintree;
    140132        int adl_todo;
    141 };
    142 
    143 struct msn_switchboard {
    144         struct im_connection *ic;
    145 
    146         /* The following two are also in the handler. TODO: Clean up. */
    147         int fd;
    148         gint inp;
    149         struct msn_handler_data *handler;
    150         gint keepalive;
    151 
    152         int trId;
    153         int ready;
    154 
    155         int session;
    156         char *key;
    157 
    158         GSList *msgq;
    159         char *who;
    160         struct groupchat *chat;
    161133};
    162134
     
    205177#define STATUS_FATAL            1
    206178#define STATUS_SB_FATAL         2
    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). */
    209179
    210180extern int msn_chat_id;
     
    218188   before doing *anything* else. */
    219189extern GSList *msn_connections;
    220 extern GSList *msn_switchboards;
    221190
    222191/* ns.c */
    223192int msn_ns_write(struct im_connection *ic, int fd, const char *fmt, ...) G_GNUC_PRINTF(3, 4);
    224 gboolean msn_ns_connect(struct im_connection *ic, struct msn_handler_data *handler, const char *host, int port);
    225 void msn_ns_close(struct msn_handler_data *handler);
     193gboolean msn_ns_connect(struct im_connection *ic, const char *host, int port);
     194void msn_ns_close(struct msn_data *handler);
    226195void msn_auth_got_passport_token(struct im_connection *ic, const char *token, const char *error);
    227196void msn_auth_got_contact_list(struct im_connection *ic);
     
    229198int msn_ns_sendmessage(struct im_connection *ic, struct bee_user *bu, const char *text);
    230199void msn_ns_oim_send_queue(struct im_connection *ic, GSList **msgq);
     200int msn_ns_command(struct msn_data *md, char **cmd, int num_parts);
     201int msn_ns_message(struct msn_data *md, char *msg, int msglen, char **cmd, int num_parts);
    231202
    232203/* msn_util.c */
     
    236207void msn_buddy_ask(bee_user_t *bu);
    237208char **msn_linesplit(char *line);
    238 int msn_handler(struct msn_handler_data *h);
     209int msn_handler(struct msn_data *h);
    239210void msn_msgq_purge(struct im_connection *ic, GSList **list);
    240211char *msn_p11_challenge(char *challenge);
     
    251222const struct msn_status_code *msn_status_by_number(int number);
    252223
    253 /* sb.c */
    254 int msn_sb_write(struct msn_switchboard *sb, const char *fmt, ...) G_GNUC_PRINTF(2, 3);;
    255 struct msn_switchboard *msn_sb_create(struct im_connection *ic, char *host, int port, char *key, int session);
    256 struct msn_switchboard *msn_sb_by_handle(struct im_connection *ic, const char *handle);
    257 struct msn_switchboard *msn_sb_by_chat(struct groupchat *c);
    258 struct msn_switchboard *msn_sb_spare(struct im_connection *ic);
    259 int msn_sb_sendmessage(struct msn_switchboard *sb, char *text);
    260 struct groupchat *msn_sb_to_chat(struct msn_switchboard *sb);
    261 void msn_sb_destroy(struct msn_switchboard *sb);
    262 gboolean msn_sb_connected(gpointer data, gint source, b_input_condition cond);
    263 int msn_sb_write_msg(struct im_connection *ic, struct msn_message *m);
    264 void msn_sb_start_keepalives(struct msn_switchboard *sb, gboolean initial);
    265 void msn_sb_stop_keepalives(struct msn_switchboard *sb);
    266 
    267224#endif //_MSN_H
Note: See TracChangeset for help on using the changeset viewer.