Ignore:
Timestamp:
2015-03-15T14:41:47Z (10 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.c

    r3752019 rffa5b70  
    3030int msn_chat_id;
    3131GSList *msn_connections;
    32 GSList *msn_switchboards;
    3332
    3433static char *set_eval_display_name(set_t *set, char *value);
     
    4847
    4948        set_add(&acc->set, "mail_notifications", "false", set_eval_bool, acc);
    50         set_add(&acc->set, "switchboard_keepalives", "false", set_eval_bool, acc);
    5149
    5250        acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE |
     
    8078        md->away_state = msn_away_state_list;
    8179        md->domaintree = g_tree_new(msn_domaintree_cmp);
    82         md->ns->fd = -1;
     80        md->fd = -1;
    8381
    8482        msn_connections = g_slist_prepend(msn_connections, ic);
    8583
    8684        imcb_log(ic, "Connecting");
    87         msn_ns_connect(ic, md->ns, server,
     85        msn_ns_connect(ic, server,
    8886                       set_getint(&ic->acc->set, "port"));
    8987}
     
    9694
    9795        if (md) {
    98                 msn_ns_close(md->ns);
    99 
    100                 while (md->switchboards) {
    101                         msn_sb_destroy(md->switchboards->data);
    102                 }
     96                msn_ns_close(md);
    10397
    10498                msn_msgq_purge(ic, &md->msgq);
     
    154148{
    155149        struct bee_user *bu = bee_user_by_handle(ic->bee, ic, who);
    156         struct msn_buddy_data *bd = bu ? bu->data : NULL;
    157         struct msn_switchboard *sb;
    158150
    159151#ifdef DEBUG
    160152        if (strcmp(who, "raw") == 0) {
    161153                msn_ns_write(ic, -1, "%s\r\n", message);
    162         } else
     154                return 0;
     155        }
    163156#endif
    164         if (bd && bd->flags & MSN_BUDDY_FED) {
    165                 msn_ns_sendmessage(ic, bu, message);
    166         } else if ((sb = msn_sb_by_handle(ic, who))) {
    167                 return(msn_sb_sendmessage(sb, message));
    168         } else {
    169                 struct msn_message *m;
    170 
    171                 /* Create a message. We have to arrange a usable switchboard, and send the message later. */
    172                 m = g_new0(struct msn_message, 1);
    173                 m->who = g_strdup(who);
    174                 m->text = g_strdup(message);
    175 
    176                 return msn_sb_write_msg(ic, m);
    177         }
    178 
     157
     158        msn_ns_sendmessage(ic, bu, message);
    179159        return(0);
    180160}
     
    198178static void msn_set_away(struct im_connection *ic, char *state, char *message)
    199179{
    200         char *uux;
     180        //char *uux;
    201181        struct msn_data *md = ic->proto_data;
    202182
     
    258238static void msn_chat_msg(struct groupchat *c, char *message, int flags)
    259239{
    260         struct msn_switchboard *sb = msn_sb_by_chat(c);
    261 
    262         if (sb) {
    263                 msn_sb_sendmessage(sb, message);
    264         }
    265         /* FIXME: Error handling (although this can't happen unless something's
    266            already severely broken) disappeared here! */
     240        /* TODO: groupchats*/
    267241}
    268242
    269243static void msn_chat_invite(struct groupchat *c, char *who, char *message)
    270244{
    271         struct msn_switchboard *sb = msn_sb_by_chat(c);
    272 
    273         if (sb) {
    274                 msn_sb_write(sb, "CAL %d %s\r\n", ++sb->trId, who);
    275         }
     245        /* TODO: groupchats*/
    276246}
    277247
    278248static void msn_chat_leave(struct groupchat *c)
    279249{
    280         struct msn_switchboard *sb = msn_sb_by_chat(c);
    281 
    282         if (sb) {
    283                 msn_sb_write(sb, "OUT\r\n");
    284         }
     250        /* TODO: groupchats*/
    285251}
    286252
    287253static struct groupchat *msn_chat_with(struct im_connection *ic, char *who)
    288254{
    289         struct msn_switchboard *sb;
     255        /* TODO: groupchats*/
    290256        struct groupchat *c = imcb_chat_new(ic, who);
    291 
    292         if ((sb = msn_sb_by_handle(ic, who))) {
    293                 debug("Converting existing switchboard to %s to a groupchat", who);
    294                 return msn_sb_to_chat(sb);
    295         } else {
    296                 struct msn_message *m;
    297 
    298                 /* Create a magic message. This is quite hackish, but who cares? :-P */
    299                 m = g_new0(struct msn_message, 1);
    300                 m->who = g_strdup(who);
    301                 m->text = g_strdup(GROUPCHAT_SWITCHBOARD_MESSAGE);
    302 
    303                 msn_sb_write_msg(ic, m);
    304 
    305                 return c;
    306         }
     257        return c;
    307258}
    308259
     
    324275static void msn_add_deny(struct im_connection *ic, char *who)
    325276{
    326         struct msn_switchboard *sb;
    327 
    328277        msn_buddy_list_add(ic, MSN_BUDDY_BL, who, who, NULL);
    329 
    330         /* If there's still a conversation with this person, close it. */
    331         if ((sb = msn_sb_by_handle(ic, who))) {
    332                 msn_sb_destroy(sb);
    333         }
    334278}
    335279
Note: See TracChangeset for help on using the changeset viewer.