comparison src/protocols/oscar/locate.c @ 10436:08c8a18fb557

[gaim-migrate @ 11693] Add a libfaim callback for anytime we get userinfo about a buddy. this takes care of sf patch #920579. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 27 Dec 2004 20:40:31 +0000
parents 9f358a718f38
children 3e2cd3fe8897
comparison
equal deleted inserted replaced
10435:341d4932f89e 10436:08c8a18fb557
33 33
34 /* 34 /*
35 * Perhaps better called AIM_CAPS_SHORTCAPS 35 * Perhaps better called AIM_CAPS_SHORTCAPS
36 */ 36 */
37 {AIM_CAPS_ICHAT, 37 {AIM_CAPS_ICHAT,
38 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 38 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
39 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 39 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
40 40
41 {AIM_CAPS_SECUREIM, 41 {AIM_CAPS_SECUREIM,
42 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 42 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
43 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 43 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
44 44
45 {AIM_CAPS_VIDEO, 45 {AIM_CAPS_VIDEO,
46 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 46 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 47 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
48 48
49 /* "Live Video" support in Windows AIM 5.5.3501 and newer */ 49 /* "Live Video" support in Windows AIM 5.5.3501 and newer */
50 {AIM_CAPS_LIVEVIDEO, 50 {AIM_CAPS_LIVEVIDEO,
51 {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 51 {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
52 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 52 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
53 53
54 /* "Camera" support in Windows AIM 5.5.3501 and newer */ 54 /* "Camera" support in Windows AIM 5.5.3501 and newer */
55 {AIM_CAPS_CAMERA, 55 {AIM_CAPS_CAMERA,
56 {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, 56 {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1,
57 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 57 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
58 58
59 /* In Windows AIM 5.5.3501 and newer */ 59 /* In Windows AIM 5.5.3501 and newer */
60 {AIM_CAPS_GENERICUNKNOWN, 60 {AIM_CAPS_GENERICUNKNOWN,
61 {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 61 {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
62 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 62 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
63 63
64 /* In iChatAV (version numbers...?) */ 64 /* In iChatAV (version numbers...?) */
65 {AIM_CAPS_ICHATAV, 65 {AIM_CAPS_ICHATAV,
66 {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 66 {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
67 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}, 67 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}},
68 68
69 /* 69 /*
70 * Not really sure about this one. In an email from 70 * Not really sure about this one. In an email from
71 * 26 Sep 2003, Matthew Sachs suggested that, "this 71 * 26 Sep 2003, Matthew Sachs suggested that, "this
72 * is probably the capability for the SMS features." 72 * is probably the capability for the SMS features."
73 */ 73 */
74 {AIM_CAPS_SMS, 74 {AIM_CAPS_SMS,
75 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, 75 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1,
76 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 76 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
77 77
78 {AIM_CAPS_GENERICUNKNOWN, 78 {AIM_CAPS_GENERICUNKNOWN,
79 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 79 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
80 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 80 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
81 81
82 {AIM_CAPS_GENERICUNKNOWN, 82 {AIM_CAPS_GENERICUNKNOWN,
83 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, 83 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1,
84 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 84 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
85 85
86 {AIM_CAPS_GENERICUNKNOWN, 86 {AIM_CAPS_GENERICUNKNOWN,
87 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 87 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
88 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 88 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
89 89
90 {AIM_CAPS_HIPTOP, 90 {AIM_CAPS_HIPTOP,
91 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, 91 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1,
92 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 92 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
93 93
94 {AIM_CAPS_TALK, 94 {AIM_CAPS_TALK,
95 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 95 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
96 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 96 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
97 97
98 {AIM_CAPS_SENDFILE, 98 {AIM_CAPS_SENDFILE,
99 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 99 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
100 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 100 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
101 101
102 {AIM_CAPS_ICQ_DIRECT, 102 {AIM_CAPS_ICQ_DIRECT,
103 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 103 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
104 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 104 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
105 105
106 {AIM_CAPS_DIRECTIM, 106 {AIM_CAPS_DIRECTIM,
107 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 107 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
108 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 108 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
109 109
110 {AIM_CAPS_BUDDYICON, 110 {AIM_CAPS_BUDDYICON,
111 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 111 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
112 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 112 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
113 113
114 {AIM_CAPS_ADDINS, 114 {AIM_CAPS_ADDINS,
115 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, 115 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
116 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 116 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
163 163
164 /* 164 /*
165 * Chat is oddball. 165 * Chat is oddball.
166 */ 166 */
167 {AIM_CAPS_CHAT, 167 {AIM_CAPS_CHAT,
168 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 168 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
169 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, 169 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
170 170
171 /* 171 /*
172 {AIM_CAPS_ICQ2GO, 172 {AIM_CAPS_ICQ2GO,
173 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, 173 {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd,
178 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 178 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
179 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, 179 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
180 180
181 /* This is added by the servers and it only shows up for ourselves... */ 181 /* This is added by the servers and it only shows up for ourselves... */
182 {AIM_CAPS_GENERICUNKNOWN, 182 {AIM_CAPS_GENERICUNKNOWN,
183 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 183 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
184 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, 184 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}},
185 185
186 {AIM_CAPS_APINFO, 186 {AIM_CAPS_APINFO,
187 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, 187 {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6,
188 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, 188 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}},
199 }; 199 };
200 200
201 /* 201 /*
202 * Add the userinfo to our linked list. If we already have userinfo 202 * Add the userinfo to our linked list. If we already have userinfo
203 * for this buddy, then just overwrite parts of the old data. 203 * for this buddy, then just overwrite parts of the old data.
204 *
204 * @param userinfo Contains the new information for the buddy. 205 * @param userinfo Contains the new information for the buddy.
205 */ 206 */
206 static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) { 207 static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) {
207 aim_userinfo_t *cur; 208 aim_userinfo_t *cur;
209 aim_conn_t *conn;
210 aim_rxcallback_t userfunc;
208 211
209 cur = aim_locate_finduserinfo(sess, userinfo->sn); 212 cur = aim_locate_finduserinfo(sess, userinfo->sn);
210 213
211 if (cur == NULL) { 214 if (cur == NULL) {
212 cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t)); 215 cur = (aim_userinfo_t *)calloc(1, sizeof(aim_userinfo_t));
259 } else 262 } else
260 cur->away = NULL; 263 cur->away = NULL;
261 cur->away_encoding = strdup(userinfo->away_encoding); 264 cur->away_encoding = strdup(userinfo->away_encoding);
262 cur->away_len = userinfo->away_len; 265 cur->away_len = userinfo->away_len;
263 } 266 }
267
268 /*
269 * This callback can be used by a client if they want to know whenever
270 * info for a buddy is updated. For example, if a client shows away
271 * messages in its buddy list, then it would need to know if a user's
272 * away message changes.
273 */
274 conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC);
275 if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_GOTINFOBLOCK)))
276 userfunc(sess, NULL, cur);
264 } 277 }
265 278
266 faim_export void aim_locate_dorequest(aim_session_t *sess) { 279 faim_export void aim_locate_dorequest(aim_session_t *sess) {
267 struct userinfo_node *cur = sess->locate.torequest; 280 struct userinfo_node *cur = sess->locate.torequest;
268 281
837 } 850 }
838 #endif 851 #endif
839 852
840 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) 853 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
841 aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); 854 aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities);
842 855
843 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) 856 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
844 aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); 857 aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen);
845 858
846 aimbs_put16(bs, aim_tlvlist_count(&tlvlist)); 859 aimbs_put16(bs, aim_tlvlist_count(&tlvlist));
847 aim_tlvlist_write(bs, &tlvlist); 860 aim_tlvlist_write(bs, &tlvlist);
1080 1093
1081 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn)))) 1094 if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
1082 return -ENOMEM; 1095 return -ENOMEM;
1083 1096
1084 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0); 1097 snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0);
1085 1098
1086 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid); 1099 aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
1087 aimbs_put16(&fr->data, infotype); 1100 aimbs_put16(&fr->data, infotype);
1088 aimbs_put8(&fr->data, strlen(sn)); 1101 aimbs_put8(&fr->data, strlen(sn));
1089 aimbs_putraw(&fr->data, sn, strlen(sn)); 1102 aimbs_putraw(&fr->data, sn, strlen(sn));
1090 1103