comparison src/protocols/oscar/ssi.c @ 4282:aa20cc16dc08

[gaim-migrate @ 4533] Let's see here... I kinda rewrote normalize. I think it should be more efficient this way, because memory isn't allocated. I dunno. That function is called quite a bit, though. The ngettext thing is cool, but having parameters in the right order is cooler. :-) I made is so aliases on the server list overwrite the local aliases. They would only be the same if you sign on elsewhere and change them, so this should be ok. I renamed some variables in ssi.c. Time Warner is still a horrible, horrible company. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 10 Jan 2003 23:08:56 +0000
parents ff0642fab1d5
children 78a3d2caf84c
comparison
equal deleted inserted replaced
4281:d956ac6157cd 4282:aa20cc16dc08
416 if (cur) { 416 if (cur) {
417 aim_tlvlist_t *tlvlist = cur->data; 417 aim_tlvlist_t *tlvlist = cur->data;
418 if (tlvlist) { 418 if (tlvlist) {
419 aim_tlv_t *tlv = aim_gettlv(tlvlist, 0x0131, 1); 419 aim_tlv_t *tlv = aim_gettlv(tlvlist, 0x0131, 1);
420 if (tlv && tlv->length) { 420 if (tlv && tlv->length) {
421 char *alias = (char *)(char *)malloc((tlv->length+1)*sizeof(char)); 421 char *alias = (char *)malloc((tlv->length+1)*sizeof(char));
422 strncpy(alias, tlv->value, tlv->length); 422 strncpy(alias, tlv->value, tlv->length);
423 alias[tlv->length] = 0; 423 alias[tlv->length] = 0;
424 return alias; 424 return alias;
425 } 425 }
426 } 426 }
1095 * timestamp and revision. 1095 * timestamp and revision.
1096 * 1096 *
1097 * Note that the client should never increment the revision, only the server. 1097 * Note that the client should never increment the revision, only the server.
1098 * 1098 *
1099 */ 1099 */
1100 faim_export int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, fu16_t localrev) 1100 faim_export int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t timestamp, fu16_t numitems)
1101 { 1101 {
1102 aim_frame_t *fr; 1102 aim_frame_t *fr;
1103 aim_snacid_t snacid; 1103 aim_snacid_t snacid;
1104 1104
1105 if (!sess || !conn) 1105 if (!sess || !conn)
1109 return -ENOMEM; 1109 return -ENOMEM;
1110 1110
1111 snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, NULL, 0); 1111 snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, NULL, 0);
1112 1112
1113 aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, snacid); 1113 aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_REQLIST, 0x0000, snacid);
1114 aimbs_put32(&fr->data, localstamp); 1114 aimbs_put32(&fr->data, timestamp);
1115 aimbs_put16(&fr->data, localrev); 1115 aimbs_put16(&fr->data, numitems);
1116 1116
1117 aim_tx_enqueue(sess, fr); 1117 aim_tx_enqueue(sess, fr);
1118 1118
1119 /* Free any current data, just in case */ 1119 /* Free any current data, just in case */
1120 aim_ssi_freelist(sess); 1120 aim_ssi_freelist(sess);
1128 static int parsedata(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) 1128 static int parsedata(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
1129 { 1129 {
1130 int ret = 0; 1130 int ret = 0;
1131 aim_rxcallback_t userfunc; 1131 aim_rxcallback_t userfunc;
1132 fu8_t fmtver; /* guess */ 1132 fu8_t fmtver; /* guess */
1133 fu16_t numitems, namelen, gid, bid, type; 1133 fu16_t namelen, gid, bid, type;
1134 fu32_t timestamp;
1135 char *name; 1134 char *name;
1136 aim_tlvlist_t *data; 1135 aim_tlvlist_t *data;
1137 1136
1138 if (snac->flags & 0x0001) { 1137 if (snac->flags & 0x0001) {
1139 /* XXX - Free all ssi data? */ 1138 /* XXX - Free all ssi data? */
1140 } 1139 }
1141 1140
1142 fmtver = aimbs_get8(bs); /* Version of ssi data. Should be 0x00 */ 1141 fmtver = aimbs_get8(bs); /* Version of ssi data. Should be 0x00 */
1143 numitems = aimbs_get16(bs); /* # of items in this SSI SNAC */ 1142 sess->ssi.numitems += aimbs_get16(bs); /* # of items in this SSI SNAC */
1144 sess->ssi.numitems += numitems;
1145 1143
1146 /* Read in the list */ 1144 /* Read in the list */
1147 while (aim_bstream_empty(bs) > 4) { /* last four bytes are timestamp */ 1145 while (aim_bstream_empty(bs) > 4) { /* last four bytes are timestamp */
1148 if ((namelen = aimbs_get16(bs))) 1146 if ((namelen = aimbs_get16(bs)))
1149 name = aimbs_getstr(bs, namelen); 1147 name = aimbs_getstr(bs, namelen);
1157 free(name); 1155 free(name);
1158 aim_freetlvchain(&data); 1156 aim_freetlvchain(&data);
1159 } 1157 }
1160 1158
1161 /* Read in the timestamp */ 1159 /* Read in the timestamp */
1162 timestamp = aimbs_get32(bs); 1160 sess->ssi.timestamp = aimbs_get32(bs);
1163 sess->ssi.timestamp = timestamp;
1164 1161
1165 if (!(snac->flags & 0x0001)) { 1162 if (!(snac->flags & 0x0001)) {
1166 /* Make a copy of the list */ 1163 /* Make a copy of the list */
1167 struct aim_ssi_item *cur; 1164 struct aim_ssi_item *cur;
1168 for (cur=sess->ssi.official; cur; cur=cur->next) 1165 for (cur=sess->ssi.official; cur; cur=cur->next)