comparison src/protocols/oscar/misc.c @ 2931:10a2d4d5bcf2

[gaim-migrate @ 2944] heh. committer: Tailor Script <tailor@pidgin.im>
author Adam Fritzler <mid@auk.cx>
date Tue, 15 Jan 2002 04:07:08 +0000
parents 6d62d4520460
children 07283934dedd
comparison
equal deleted inserted replaced
2930:adf08f4c9e9d 2931:10a2d4d5bcf2
28 */ 28 */
29 faim_export int aim_bos_setbuddylist(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list) 29 faim_export int aim_bos_setbuddylist(aim_session_t *sess, aim_conn_t *conn, const char *buddy_list)
30 { 30 {
31 aim_frame_t *fr; 31 aim_frame_t *fr;
32 aim_snacid_t snacid; 32 aim_snacid_t snacid;
33 int i, len = 0; 33 int len = 0;
34 char *localcpy = NULL; 34 char *localcpy = NULL;
35 char *tmpptr = NULL; 35 char *tmpptr = NULL;
36 36
37 if (!buddy_list || !(localcpy = strdup(buddy_list))) 37 if (!buddy_list || !(localcpy = strdup(buddy_list)))
38 return -EINVAL; 38 return -EINVAL;
39 39
40 i = 0; 40 for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
41 tmpptr = strtok(localcpy, "&"); 41 faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
42 while ((tmpptr != NULL) && (i < 150)) { 42 len += 1 + strlen(tmpptr);
43 faimdprintf(sess, 2, "---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr));
44 len += 1+strlen(tmpptr);
45 i++;
46 tmpptr = strtok(NULL, "&"); 43 tmpptr = strtok(NULL, "&");
47 } 44 }
48 45
49 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+len))) 46 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+len)))
50 return -ENOMEM; 47 return -ENOMEM;
51 48
52 snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0); 49 snacid = aim_cachesnac(sess, 0x0003, 0x0004, 0x0000, NULL, 0);
53
54 aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid); 50 aim_putsnac(&fr->data, 0x0003, 0x0004, 0x0000, snacid);
55 51
56 strncpy(localcpy, buddy_list, strlen(buddy_list)+1); 52 strncpy(localcpy, buddy_list, strlen(buddy_list) + 1);
57 i = 0; 53
58 tmpptr = strtok(localcpy, "&"); 54 for (tmpptr = strtok(localcpy, "&"); tmpptr; ) {
59 while ((tmpptr != NULL) & (i < 150)) { 55
60 faimdprintf(sess, 2, "---adding %d: %s (%d)\n", i, tmpptr, strlen(tmpptr)); 56 faimdprintf(sess, 2, "---adding: %s (%d)\n", tmpptr, strlen(tmpptr));
61 57
62 aimbs_put8(&fr->data, strlen(tmpptr)); 58 aimbs_put8(&fr->data, strlen(tmpptr));
63 aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr)); 59 aimbs_putraw(&fr->data, tmpptr, strlen(tmpptr));
64 i++;
65 tmpptr = strtok(NULL, "&"); 60 tmpptr = strtok(NULL, "&");
66 } 61 }
67 62
68 aim_tx_enqueue(sess, fr); 63 aim_tx_enqueue(sess, fr);
69 64