Changeset 0eb971a
- Timestamp:
- 2012-10-19T22:39:10Z (12 years ago)
- Branches:
- master
- Children:
- 386042c
- Parents:
- 13df515
- Location:
- protocols
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.h
r13df515 r0eb971a 198 198 void (* rem_permit) (struct im_connection *, char *who); 199 199 void (* rem_deny) (struct im_connection *, char *who); 200 /* Doesn't actually have UI hooks. */200 /* Doesn't actually have UI hooks. Not used at all, can be removed. */ 201 201 void (* set_permit_deny)(struct im_connection *); 202 202 -
protocols/oscar/aim.h
r13df515 r0eb971a 606 606 int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); 607 607 int aim_bos_setidle(aim_session_t *, aim_conn_t *, guint32); 608 int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *);609 608 int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *); 610 609 int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, guint32 caps); -
protocols/oscar/bos.c
r13df515 r0eb971a 56 56 } 57 57 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 you64 * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list65 * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names66 * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again67 *68 * list should be a list of69 * 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_DENYADD73 * with only your name on it.74 * - Allow only users on my Buddy List: Send an75 * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your76 * buddy list77 * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD78 * with everyone listed that you want to see you.79 * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only80 * yourself in the list81 * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with82 * the list of users to be blocked83 *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 else108 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 138 58 static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 139 59 { -
protocols/oscar/oscar.c
r13df515 r0eb971a 2103 2103 } 2104 2104 2105 static void oscar_set_permit_deny(struct im_connection *ic) {2106 struct oscar_data *od = (struct oscar_data *)ic->proto_data;2107 if (od->icq) {2108 GSList *list;2109 char buf[MAXMSGLEN];2110 int at;2111 2112 switch(ic->permdeny) {2113 case 1:2114 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, ic->acc->user);2115 break;2116 case 2:2117 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, ic->acc->user);2118 break;2119 case 3:2120 list = ic->permit;2121 at = 0;2122 while (list) {2123 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);2124 list = list->next;2125 }2126 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf);2127 break;2128 case 4:2129 list = ic->deny;2130 at = 0;2131 while (list) {2132 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data);2133 list = list->next;2134 }2135 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf);2136 break;2137 default:2138 break;2139 }2140 } else {2141 if (od->sess->ssi.received_data)2142 aim_ssi_setpermdeny(od->sess, od->conn, ic->permdeny, 0xffffffff);2143 }2144 }2145 2146 2105 static void oscar_add_permit(struct im_connection *ic, char *who) { 2147 2106 struct oscar_data *od = (struct oscar_data *)ic->proto_data; … … 2624 2583 ret->rem_permit = oscar_rem_permit; 2625 2584 ret->rem_deny = oscar_rem_deny; 2626 ret->set_permit_deny = oscar_set_permit_deny;2627 2585 ret->send_typing = oscar_send_typing; 2628 2586 -
protocols/oscar/ssi.c
r13df515 r0eb971a 1000 1000 1001 1001 /** 1002 * Stores your permit/deny setting on the server, and starts using it.1003 *1004 * @param sess The oscar session.1005 * @param conn The bos connection for this session.1006 * @param permdeny Your permit/deny setting. Can be one of the following:1007 * 1 - Allow all users1008 * 2 - Block all users1009 * 3 - Allow only the users below1010 * 4 - Block only the users below1011 * 5 - Allow only users on my buddy list1012 * @param vismask A bitmask of the class of users to whom you want to be1013 * visible. See the AIM_FLAG_BLEH #defines in aim.h1014 * @return Return 0 if no errors, otherwise return the error number.1015 */1016 int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, guint8 permdeny, guint32 vismask) {1017 struct aim_ssi_item *cur; //, *tmp;1018 // guint16 j;1019 aim_tlv_t *tlv;1020 1021 if (!sess || !conn)1022 return -EINVAL;1023 1024 /* Look up the permit/deny settings item */1025 cur = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PDINFO);1026 1027 if (cur) {1028 /* The permit/deny item exists */1029 if (cur->data && (tlv = aim_gettlv(cur->data, 0x00ca, 1))) {1030 /* Just change the value of the x00ca TLV */1031 if (tlv->length != 1) {1032 tlv->length = 1;1033 g_free(tlv->value);1034 tlv->value = (guint8 *)g_malloc(sizeof(guint8));1035 }1036 tlv->value[0] = permdeny;1037 } else {1038 /* Need to add the x00ca TLV to the TLV chain */1039 aim_addtlvtochain8((aim_tlvlist_t**)&cur->data, 0x00ca, permdeny);1040 }1041 1042 if (cur->data && (tlv = aim_gettlv(cur->data, 0x00cb, 1))) {1043 /* Just change the value of the x00cb TLV */1044 if (tlv->length != 4) {1045 tlv->length = 4;1046 g_free(tlv->value);1047 tlv->value = (guint8 *)g_malloc(4*sizeof(guint8));1048 }1049 aimutil_put32(tlv->value, vismask);1050 } else {1051 /* Need to add the x00cb TLV to the TLV chain */1052 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00cb, vismask);1053 }1054 1055 /* Send the mod item SNAC */1056 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_MOD);1057 } else {1058 /* Need to add the permit/deny item */1059 if (!(cur = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_PDINFO)))1060 return -ENOMEM;1061 aim_addtlvtochain8((aim_tlvlist_t**)&cur->data, 0x00ca, permdeny);1062 aim_addtlvtochain32((aim_tlvlist_t**)&cur->data, 0x00cb, vismask);1063 aim_ssi_addmoddel(sess, conn, &cur, 1, AIM_CB_SSI_ADD);1064 }1065 1066 /* Begin sending SSI SNACs */1067 aim_ssi_dispatch(sess, conn);1068 1069 return 0;1070 }1071 1072 /**1073 1002 * Stores your setting for whether you should show up as idle or not. 1074 1003 * -
protocols/oscar/ssi.h
r13df515 r0eb971a 71 71 int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn); 72 72 int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned int num, guint16 type); 73 int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, guint8 permdeny, guint32 vismask);74 73 int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, guint32 presence); 75 74 int aim_ssi_auth_request(aim_session_t *sess, aim_conn_t *conn, char *uin, char *reason);
Note: See TracChangeset
for help on using the changeset viewer.