pidgin.mxit: 6ee59dee: Defined User Search request packets.
andrew.victor at mxit.com
andrew.victor at mxit.com
Fri Jan 7 17:40:49 EST 2011
----------------------------------------------------------------------
Revision: 6ee59dee0c657b956f31bc42ac408d7a95becffc
Parent: f0aa6a6b3f0d66046ccee55030c8a8d5e3f9e067
Author: andrew.victor at mxit.com
Date: 01/07/11 17:20:18
Branch: im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/6ee59dee0c657b956f31bc42ac408d7a95becffc
Changelog:
Defined User Search request packets.
Changes against parent f0aa6a6b3f0d66046ccee55030c8a8d5e3f9e067
patched libpurple/protocols/mxit/protocol.c
patched libpurple/protocols/mxit/protocol.h
-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/protocol.c 7cd5420f0f45e0a833fee08364f54c7c1c550dc9
+++ libpurple/protocols/mxit/protocol.c 458f0d0ef894aac18e40dc72546b02fda74c60d2
@@ -747,7 +747,7 @@ void mxit_send_message( struct MXitSessi
* @param session The MXit session object
* @param username Username who's profile is being requested (NULL = our own)
* @param nr_attribs Number of attributes being requested
- * @param attributes The names of the attributes
+ * @param attribute The names of the attributes
*/
void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] )
{
@@ -757,7 +757,8 @@ void mxit_send_extprofile_request( struc
datalen = snprintf( data, sizeof( data ),
"ms=%s%c%i", /* "ms="mxitid\1nr_attributes */
- (username ? username : ""), CP_FLD_TERM, nr_attrib);
+ ( username ? username : "" ), CP_FLD_TERM, nr_attrib
+ );
/* add attributes */
for ( i = 0; i < nr_attrib; i++ )
@@ -805,6 +806,63 @@ void mxit_send_extprofile_update( struct
/*------------------------------------------------------------------------
+ * Send packet to request list of suggested friends.
+ *
+ * @param session The MXit session object
+ * @param max Maximum number of results to return
+ * @param nr_attribs Number of attributes being requested
+ * @param attribute The names of the attributes
+ */
+void mxit_send_suggest_friends( struct MXitSession* session, int max, unsigned int nr_attrib, const char* attribute[] )
+{
+ char data[CP_MAX_PACKET];
+ int datalen;
+ unsigned int i;
+
+ /* convert the packet to a byte stream */
+ datalen = snprintf( data, sizeof( data ),
+ "ms=%i%c%s%c%i%c%i", /* inputType \1 input \ 1 maxSuggestions \1 numAttributes \1 name0 ... \1 nameN */
+ CP_SUGGEST_FRIENDS, CP_FLD_TERM, "", CP_FLD_TERM, max, CP_FLD_TERM, nr_attrib );
+
+ /* add attributes */
+ for ( i = 0; i < nr_attrib; i++ )
+ datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] );
+
+ /* queue packet for transmission */
+ mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_GET );
+}
+
+
+/*------------------------------------------------------------------------
+ * Send packet to perform a search for users.
+ *
+ * @param session The MXit session object
+ * @param max Maximum number of results to return
+ * @param text The search text
+ * @param nr_attribs Number of attributes being requested
+ * @param attribute The names of the attributes
+ */
+void mxit_send_suggest_search( struct MXitSession* session, int max, const char* text, unsigned int nr_attrib, const char* attribute[] )
+{
+ char data[CP_MAX_PACKET];
+ int datalen;
+ unsigned int i;
+
+ /* convert the packet to a byte stream */
+ datalen = snprintf( data, sizeof( data ),
+ "ms=%i%c%s%c%i%c%i", /* inputType \1 input \ 1 maxSuggestions \1 numAttributes \1 name0 ... \1 nameN */
+ CP_SUGGEST_SEARCH, CP_FLD_TERM, text, CP_FLD_TERM, max, CP_FLD_TERM, nr_attrib );
+
+ /* add attributes */
+ for ( i = 0; i < nr_attrib; i++ )
+ datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] );
+
+ /* queue packet for transmission */
+ mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_GET );
+}
+
+
+/*------------------------------------------------------------------------
* Send a presence update packet to the MXit server.
*
* @param session The MXit session object
============================================================
--- libpurple/protocols/mxit/protocol.h 34a2e1a9cb9f285e9616e5d852c486f415c76027
+++ libpurple/protocols/mxit/protocol.h 36e7dde5032a559540de7b38fa023eb657088ff7
@@ -127,6 +127,7 @@
#define CP_CMD_TX_MSG 0x000A /* (10) send new message */
#define CP_CMD_REGISTER 0x000B /* (11) register */
//#define CP_CMD_PROFILE_SET 0x000C /* (12) set profile (DEPRECATED see CP_CMD_EXTPROFILE_SET) */
+#define CP_CMD_SUGGESTCONTACTS 0x000D /* (13) suggest contacts */
#define CP_CMD_POLL 0x0011 /* (17) poll the HTTP server for an update */
//#define CP_CMD_PROFILE_GET 0x001A /* (26) get profile (DEPRECATED see CP_CMD_EXTPROFILE_GET) */
#define CP_CMD_MEDIA 0x001B /* (27) get multimedia message */
@@ -204,6 +205,12 @@
/* profile flags */
#define CP_PROF_DOBLOCKED 0x40 /* date-of-birth cannot be changed */
+/* suggestion types */
+#define CP_SUGGEST_ADDRESSBOOK 0 /* address book search */
+#define CP_SUGGEST_FRIENDS 1 /* suggested friends */
+#define CP_SUGGEST_SEARCH 2 /* free-text search */
+#define CP_SUGGEST_MXITID 4 /* MXitId search */
+
/* define this to enable protocol debugging (very verbose logging) */
#define DEBUG_PROTOCOL
@@ -295,6 +302,9 @@ void mxit_send_extprofile_request( struc
void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes );
void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] );
+void mxit_send_suggest_friends( struct MXitSession* session, int max, unsigned int nr_attrib, const char* attribute[] );
+void mxit_send_suggest_search( struct MXitSession* session, int max, const char* text, unsigned int nr_attrib, const char* attribute[] );
+
void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname );
void mxit_send_remove( struct MXitSession* session, const char* username );
void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias );
More information about the Commits
mailing list