Ignore:
Timestamp:
2012-10-19T23:38:33Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
509cf60
Parents:
386042c
Message:

Massive cleanup in OSCAR.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/chat.c

    r386042c r6042a54  
    2626
    2727        return;
    28 }
    29 
    30 char *aim_chat_getname(aim_conn_t *conn)
    31 {
    32         struct chatconnpriv *ccp;
    33 
    34         if (!conn)
    35                 return NULL;
    36 
    37         if (conn->type != AIM_CONN_TYPE_CHAT)
    38                 return NULL;
    39 
    40         ccp = (struct chatconnpriv *)conn->priv;
    41 
    42         return ccp->name;
    43 }
    44 
    45 /* XXX get this into conn.c -- evil!! */
    46 aim_conn_t *aim_chat_getconn(aim_session_t *sess, const char *name)
    47 {
    48         aim_conn_t *cur;
    49 
    50         for (cur = sess->connlist; cur; cur = cur->next) {
    51                 struct chatconnpriv *ccp = (struct chatconnpriv *)cur->priv;
    52 
    53                 if (cur->type != AIM_CONN_TYPE_CHAT)
    54                         continue;
    55                 if (!cur->priv) {
    56                         imcb_error(sess->aux_data, "chat connection with no name!");
    57                         continue;
    58                 }
    59 
    60                 if (strcmp(ccp->name, name) == 0)
    61                         break;
    62         }
    63 
    64         return cur;
    65 }
    66 
    67 int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance)
    68 {
    69         struct chatconnpriv *ccp;
    70 
    71         if (!conn || !roomname)
    72                 return -EINVAL;
    73 
    74         if (conn->priv)
    75                 g_free(conn->priv);
    76 
    77         if (!(ccp = g_malloc(sizeof(struct chatconnpriv))))
    78                 return -ENOMEM;
    79 
    80         ccp->exchange = exchange;
    81         ccp->name = g_strdup(roomname);
    82         ccp->instance = instance;
    83 
    84         conn->priv = (void *)ccp;
    85 
    86         return 0;
    8728}
    8829
     
    250191        outinfo->name = aimbs_getstr(bs, namelen);
    251192        outinfo->instance = aimbs_get16(bs);
    252 
    253         return 0;
    254 }
    255 
    256 int aim_chat_leaveroom(aim_session_t *sess, const char *name)
    257 {
    258         aim_conn_t *conn;
    259 
    260         if (!(conn = aim_chat_getconn(sess, name)))
    261                 return -ENOENT;
    262 
    263         aim_conn_close(conn);
    264193
    265194        return 0;
Note: See TracChangeset for help on using the changeset viewer.