diff 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
line wrap: on
line diff
--- a/src/protocols/oscar/locate.c	Mon Dec 27 19:35:21 2004 +0000
+++ b/src/protocols/oscar/locate.c	Mon Dec 27 20:40:31 2004 +0000
@@ -35,35 +35,35 @@
 	 * Perhaps better called AIM_CAPS_SHORTCAPS
 	 */
 	{AIM_CAPS_ICHAT,
-	 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_SECUREIM,
-	 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_VIDEO,
-	 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/* "Live Video" support in Windows AIM 5.5.3501 and newer */
 	{AIM_CAPS_LIVEVIDEO,
-	 {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/* "Camera" support in Windows AIM 5.5.3501 and newer */
 	{AIM_CAPS_CAMERA,
-	 {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/* In Windows AIM 5.5.3501 and newer */
 	{AIM_CAPS_GENERICUNKNOWN,
-	 {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/* In iChatAV (version numbers...?) */
 	{AIM_CAPS_ICHATAV,
-	 {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}},
 
 	/*
@@ -72,43 +72,43 @@
 	 * is probably the capability for the SMS features."
 	 */
 	{AIM_CAPS_SMS,
-	 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_GENERICUNKNOWN,
-	 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_GENERICUNKNOWN,
-	 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_GENERICUNKNOWN,
-	 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_HIPTOP,
-	 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_TALK,
-	 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_SENDFILE,
-	 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_ICQ_DIRECT,
-	 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_DIRECTIM,
-	 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_BUDDYICON,
-	 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 
+	 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	{AIM_CAPS_ADDINS,
@@ -165,7 +165,7 @@
 	 * Chat is oddball.
 	 */
 	{AIM_CAPS_CHAT,
-	 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
+	 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
 	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
 
 	/*
@@ -180,7 +180,7 @@
 
 	/* This is added by the servers and it only shows up for ourselves... */
 	{AIM_CAPS_GENERICUNKNOWN,
-	 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 
+	 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
 	  0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}},
 
 	{AIM_CAPS_APINFO, 
@@ -201,10 +201,13 @@
 /*
  * Add the userinfo to our linked list.  If we already have userinfo 
  * for this buddy, then just overwrite parts of the old data.
+ *
  * @param userinfo Contains the new information for the buddy.
  */
 static void aim_locate_adduserinfo(aim_session_t *sess, aim_userinfo_t *userinfo) {
 	aim_userinfo_t *cur;
+	aim_conn_t *conn;
+	aim_rxcallback_t userfunc;
 
 	cur = aim_locate_finduserinfo(sess, userinfo->sn);
 
@@ -261,6 +264,16 @@
 		cur->away_encoding = strdup(userinfo->away_encoding);
 		cur->away_len = userinfo->away_len;
 	}
+
+	/*
+	 * This callback can be used by a client if they want to know whenever
+	 * info for a buddy is updated.  For example, if a client shows away
+	 * messages in its buddy list, then it would need to know if a user's
+	 * away message changes.
+	 */
+	conn = aim_conn_findbygroup(sess, AIM_CB_FAM_LOC);
+	if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_LOC, AIM_CB_LOC_GOTINFOBLOCK)))
+		userfunc(sess, NULL, cur);
 }
 
 faim_export void aim_locate_dorequest(aim_session_t *sess) {
@@ -839,7 +852,7 @@
 
 	if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES)
 		aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities);
- 
+
 	if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
 		aim_tlvlist_add_32(&tlvlist, (fu16_t)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen);
 
@@ -1082,7 +1095,7 @@
 		return -ENOMEM;
 
 	snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, NULL, 0);
-	
+
 	aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
 	aimbs_put16(&fr->data, infotype);
 	aimbs_put8(&fr->data, strlen(sn));