Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/oscar/bos.c

    rb7d3cc34 r0eb971a  
    5656}
    5757
    58 /*
    59  * Modify permit/deny lists (group 9, types 5, 6, 7, and 8)
    60  *
    61  * Changes your visibility depending on changetype:
    62  *
    63  *  AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you
    64  *  AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list
    65  *  AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names
    66  *  AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again
    67  *
    68  * list should be a list of
    69  * screen names in the form "Screen Name One&ScreenNameTwo&" etc.
    70  *
    71  * Equivelents to options in WinAIM:
    72  *   - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD
    73  *      with only your name on it.
    74  *   - Allow only users on my Buddy List: Send an
    75  *      AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your
    76  *      buddy list
    77  *   - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD
    78  *      with everyone listed that you want to see you.
    79  *   - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only
    80  *      yourself in the list
    81  *   - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with
    82  *      the list of users to be blocked
    83  *
    84  * XXX ye gods.
    85  */
    86 int aim_bos_changevisibility(aim_session_t *sess, aim_conn_t *conn, int changetype, const char *denylist)
    87 {
    88         aim_frame_t *fr;
    89         int packlen = 0;
    90         guint16 subtype;
    91         char *localcpy = NULL, *tmpptr = NULL;
    92         int i;
    93         int listcount;
    94         aim_snacid_t snacid;
    95 
    96         if (!denylist)
    97                 return -EINVAL;
    98 
    99         if (changetype == AIM_VISIBILITYCHANGE_PERMITADD)
    100                 subtype = 0x05;
    101         else if (changetype == AIM_VISIBILITYCHANGE_PERMITREMOVE)
    102                 subtype = 0x06;
    103         else if (changetype == AIM_VISIBILITYCHANGE_DENYADD)
    104                 subtype = 0x07;
    105         else if (changetype == AIM_VISIBILITYCHANGE_DENYREMOVE)
    106                 subtype = 0x08;
    107         else
    108                 return -EINVAL;
    109 
    110         localcpy = g_strdup(denylist);
    111 
    112         listcount = aimutil_itemcnt(localcpy, '&');
    113         packlen = aimutil_tokslen(localcpy, 99, '&') + listcount + 9;
    114 
    115         if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, packlen))) {
    116                 g_free(localcpy);
    117                 return -ENOMEM;
    118         }
    119 
    120         snacid = aim_cachesnac(sess, 0x0009, subtype, 0x0000, NULL, 0);
    121         aim_putsnac(&fr->data, 0x0009, subtype, 0x00, snacid);
    122 
    123         for (i = 0; (i < (listcount - 1)) && (i < 99); i++) {
    124                 tmpptr = aimutil_itemidx(localcpy, i, '&');
    125 
    126                 aimbs_put8(&fr->data, strlen(tmpptr));
    127                 aimbs_putraw(&fr->data, (guint8 *)tmpptr, strlen(tmpptr));
    128 
    129                 g_free(tmpptr);
    130         }
    131         g_free(localcpy);
    132 
    133         aim_tx_enqueue(sess, fr);
    134 
    135         return 0;
    136 }
    137 
    13858static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
    13959{
Note: See TracChangeset for help on using the changeset viewer.