Changeset 0eb971a for protocols/oscar/ssi.c
- Timestamp:
- 2012-10-19T22:39:10Z (12 years ago)
- Branches:
- master
- Children:
- 386042c
- Parents:
- 13df515
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 *
Note: See TracChangeset
for help on using the changeset viewer.