changeset 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 341d4932f89e
children 446f5f28e8d0
files src/protocols/oscar/aim_cbtypes.h src/protocols/oscar/locate.c
diffstat 2 files changed, 54 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim_cbtypes.h	Mon Dec 27 19:35:21 2004 +0000
+++ b/src/protocols/oscar/aim_cbtypes.h	Mon Dec 27 20:40:31 2004 +0000
@@ -43,7 +43,7 @@
 
 /*
  * SNAC Family: General.
- */ 
+ */
 #define AIM_CB_GEN_ERROR 0x0001
 #define AIM_CB_GEN_CLIENTREADY 0x0002
 #define AIM_CB_GEN_SERVERREADY 0x0003
@@ -68,7 +68,7 @@
 
 /*
  * SNAC Family: Location Services.
- */ 
+ */
 #define AIM_CB_LOC_ERROR 0x0001
 #define AIM_CB_LOC_REQRIGHTS 0x0002
 #define AIM_CB_LOC_RIGHTSINFO 0x0003
@@ -77,12 +77,13 @@
 #define AIM_CB_LOC_USERINFO 0x0006
 #define AIM_CB_LOC_WATCHERSUBREQ 0x0007
 #define AIM_CB_LOC_WATCHERNOT 0x0008
+#define AIM_CB_LOC_GOTINFOBLOCK 0xfffd
 #define AIM_CB_LOC_REQUESTINFOTIMEOUT 0xfffe
 #define AIM_CB_LOC_DEFAULT 0xffff
 
 /*
  * SNAC Family: Buddy List Management Services.
- */ 
+ */
 #define AIM_CB_BUD_ERROR 0x0001
 #define AIM_CB_BUD_REQRIGHTS 0x0002
 #define AIM_CB_BUD_RIGHTSINFO 0x0003
@@ -95,7 +96,7 @@
 
 /*
  * SNAC Family: Messaging Services.
- */ 
+ */
 #define AIM_CB_MSG_ERROR 0x0001
 #define AIM_CB_MSG_PARAMINFO 0x0005
 #define AIM_CB_MSG_INCOMING 0x0007
@@ -108,32 +109,32 @@
 
 /*
  * SNAC Family: Advertisement Services
- */ 
+ */
 #define AIM_CB_ADS_ERROR 0x0001
 #define AIM_CB_ADS_DEFAULT 0xffff
 
 /*
  * SNAC Family: Invitation Services.
- */ 
+ */
 #define AIM_CB_INV_ERROR 0x0001
 #define AIM_CB_INV_DEFAULT 0xffff
 
 /*
  * SNAC Family: Administrative Services.
- */ 
+ */
 #define AIM_CB_ADM_ERROR 0x0001
 #define AIM_CB_ADM_INFOCHANGE_REPLY 0x0005
 #define AIM_CB_ADM_DEFAULT 0xffff
 
 /*
  * SNAC Family: Popup Messages
- */ 
+ */
 #define AIM_CB_POP_ERROR 0x0001
 #define AIM_CB_POP_DEFAULT 0xffff
 
 /*
  * SNAC Family: Misc BOS Services.
- */ 
+ */
 #define AIM_CB_BOS_ERROR 0x0001
 #define AIM_CB_BOS_RIGHTSQUERY 0x0002
 #define AIM_CB_BOS_RIGHTS 0x0003
@@ -141,13 +142,13 @@
 
 /*
  * SNAC Family: User Lookup Services
- */ 
+ */
 #define AIM_CB_LOK_ERROR 0x0001
 #define AIM_CB_LOK_DEFAULT 0xffff
 
 /*
  * SNAC Family: User Status Services
- */ 
+ */
 #define AIM_CB_STS_ERROR 0x0001
 #define AIM_CB_STS_SETREPORTINTERVAL 0x0002
 #define AIM_CB_STS_REPORTACK 0x0004
@@ -155,13 +156,13 @@
 
 /*
  * SNAC Family: Translation Services
- */ 
+ */
 #define AIM_CB_TRN_ERROR 0x0001
 #define AIM_CB_TRN_DEFAULT 0xffff
 
 /*
  * SNAC Family: Chat Navigation Services
- */ 
+ */
 #define AIM_CB_CTN_ERROR 0x0001
 #define AIM_CB_CTN_CREATE 0x0008
 #define AIM_CB_CTN_INFO 0x0009
@@ -169,7 +170,7 @@
 
 /*
  * SNAC Family: Chat Services
- */ 
+ */
 #define AIM_CB_CHT_ERROR 0x0001
 #define AIM_CB_CHT_ROOMINFOUPDATE 0x0002
 #define AIM_CB_CHT_USERJOIN 0x0003
@@ -180,14 +181,14 @@
 
 /*
  * SNAC Family: "New" Search
- */ 
+ */
 #define AIM_CB_SCH_ERROR 0x0001
 #define AIM_CB_SCH_SEARCH 0x0002
 #define AIM_CB_SCH_RESULTS 0x0003
 
 /*
  * SNAC Family: Buddy icons
- */ 
+ */
 #define AIM_CB_ICO_ERROR 0x0001
 #define AIM_CB_ICO_REQUEST 0x0004
 #define AIM_CB_ICO_RESPONSE 0x0005
@@ -196,7 +197,7 @@
  * SNAC Family: ICQ
  *
  * Most of these are actually special.
- */ 
+ */
 #define AIM_CB_ICQ_ERROR 0x0001
 #define AIM_CB_ICQ_OFFLINEMSG 0x00f0
 #define AIM_CB_ICQ_OFFLINEMSGCOMPLETE 0x00f1
@@ -279,7 +280,7 @@
 
 #define AIM_CB_OFT_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */
 #define AIM_CB_OFT_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */
-#define AIM_CB_OFT_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? */ /* I'm just guessing about this one... */
+#define AIM_CB_OFT_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? I'm just guessing about this one... */
 #define AIM_CB_OFT_GETFILE_ACKLISTING 0x120b	/* "I received the listing.txt file successfully" */
 #define AIM_CB_OFT_GETFILE_REQUESTFILE 0x120c	/* "Please send me this file" */
 
@@ -292,7 +293,7 @@
  * these, we can integrated non-SNAC services into
  * the SNAC-centered libfaim callback structure.
  *
- */ 
+ */
 #define AIM_CB_SPECIAL_AUTHSUCCESS 0x0001
 #define AIM_CB_SPECIAL_AUTHOTHER 0x0002
 #define AIM_CB_SPECIAL_CONNERR 0x0003
--- 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));