Mercurial > pidgin
changeset 6879:594682101ba6
[gaim-migrate @ 7425]
I renamed newsearch.c to odir.c and icon.c to bart.c
I get the feeling this is what AOL calls them. I also changed the
aim_icon_bleh functions to aim_bart_bleh
aim_usersearch_bleh to aim_search_bleh or aim_odir_bleh
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 17 Sep 2003 21:19:30 +0000 |
parents | 618124fe3289 |
children | 8e0f0f492ff1 |
files | src/protocols/oscar/Makefile.am src/protocols/oscar/Makefile.mingw src/protocols/oscar/aim.h src/protocols/oscar/aim_internal.h src/protocols/oscar/bart.c src/protocols/oscar/conn.c src/protocols/oscar/icon.c src/protocols/oscar/newsearch.c src/protocols/oscar/odir.c src/protocols/oscar/oscar.c src/protocols/oscar/search.c |
diffstat | 11 files changed, 432 insertions(+), 432 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/oscar/Makefile.am Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/Makefile.am Wed Sep 17 21:19:30 2003 +0000 @@ -15,6 +15,7 @@ aim_cbtypes.h \ aim_internal.h \ auth.c \ + bart.c \ bos.c \ bstream.c \ buddylist.c \ @@ -24,7 +25,6 @@ email.c \ faimconfig.h \ ft.c \ - icon.c \ icq.c \ im.c \ info.c \ @@ -32,7 +32,7 @@ md5.h \ misc.c \ msgcookie.c \ - newsearch.c \ + odir.c \ popups.c \ rxhandlers.c \ rxqueue.c \
--- a/src/protocols/oscar/Makefile.mingw Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/Makefile.mingw Wed Sep 17 21:19:30 2003 +0000 @@ -70,6 +70,7 @@ C_SRC = admin.c \ adverts.c \ auth.c \ + bart.c \ bos.c \ bstream.c \ buddylist.c \ @@ -78,14 +79,13 @@ conn.c \ email.c \ ft.c \ - icon.c \ icq.c \ im.c \ info.c \ invite.c \ misc.c \ msgcookie.c \ - newsearch.c \ + odir.c \ popups.c \ rxhandlers.c \ rxqueue.c \
--- a/src/protocols/oscar/aim.h Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/aim.h Wed Sep 17 21:19:30 2003 +0000 @@ -1071,7 +1071,7 @@ /* 0x000a - search.c */ -faim_export int aim_usersearch_address(aim_session_t *, aim_conn_t *, const char *); +faim_export int aim_search_address(aim_session_t *, aim_conn_t *, const char *); @@ -1110,8 +1110,8 @@ -/* 0x000f - newsearch.c */ -struct aim_usersearch { +/* 0x000f - odir.c */ +struct aim_odir { char *first; char *last; char *middle; @@ -1126,18 +1126,18 @@ char *zip; char *region; char *address; - struct aim_usersearch *next; + struct aim_odir *next; }; -faim_export int aim_usersearch_email(aim_session_t *, const char *, const char *); -faim_export int aim_usersearch_name(aim_session_t *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); -faim_export int aim_usersearch_interest(aim_session_t *, const char *, const char *); +faim_export int aim_odir_email(aim_session_t *, const char *, const char *); +faim_export int aim_odir_name(aim_session_t *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); +faim_export int aim_odir_interest(aim_session_t *, const char *, const char *); /* 0x0010 - icon.c */ -faim_export int aim_icon_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen); -faim_export int aim_icon_request(aim_session_t *sess, const char *sn, const fu8_t *iconstr, fu16_t iconstrlen); +faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen); +faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconstr, fu16_t iconstrlen);
--- a/src/protocols/oscar/aim_internal.h Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/aim_internal.h Wed Sep 17 21:19:30 2003 +0000 @@ -51,8 +51,8 @@ faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int adverts_modfirst(aim_session_t *sess, aim_module_t *mod); -faim_internal int newsearch_modfirst(aim_session_t *sess, aim_module_t *mod); -faim_internal int icon_modfirst(aim_session_t *sess, aim_module_t *mod); +faim_internal int odir_modfirst(aim_session_t *sess, aim_module_t *mod); +faim_internal int bart_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int ssi_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod); faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/protocols/oscar/bart.c Wed Sep 17 21:19:30 2003 +0000 @@ -0,0 +1,165 @@ +/* + * Family 0x0010 - Server stored buddy art + * + * Used for storing and retrieving your cute little buddy icon + * from the AIM servers. + * + */ + +#define FAIM_INTERNAL +#include <aim.h> + +/** + * Subtype 0x0002 - Upload your icon. + * + * @param sess The oscar session. + * @param conn The icon connection for this session. + * @param icon The raw data of the icon image file. + * @param iconlen Length of the raw data of the icon image file. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !icon || !iconlen) + return -EINVAL; + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2+iconlen))) + return -ENOMEM; + snacid = aim_cachesnac(sess, 0x0010, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x0010, 0x0002, 0x0000, snacid); + + /* The reference number for the icon */ + aimbs_put16(&fr->data, 1); + + /* The icon */ + aimbs_put16(&fr->data, iconlen); + aimbs_putraw(&fr->data, icon, iconlen); + + aim_tx_enqueue(sess, fr); + + return 0; +} + +/** + * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. + * + * You get this honky after you upload a buddy icon. + */ +static int uploadack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +{ + int ret = 0; + aim_rxcallback_t userfunc; + fu16_t something, somethingelse; + fu8_t onemorething; + + something = aimbs_get16(bs); + somethingelse = aimbs_get16(bs); + onemorething = aimbs_get8(bs); + + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + ret = userfunc(sess, rx); + + return ret; +} + +/** + * Subtype 0x0004 - Request someone's icon. + * + * @param sess The oscar session. + * @param conn The icon connection for this session. + * @param sn The screen name of the person who's icon you are requesting. + * @param iconcsum The MD5 checksum of the icon you are requesting. + * @param iconcsumlen Length of the MD5 checksum given above. Should be 10 bytes. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconcsum, fu16_t iconcsumlen) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !sn || !strlen(sn) || !iconcsum || !iconcsumlen) + return -EINVAL; + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 1+strlen(sn) + 4 + 1+iconcsumlen))) + return -ENOMEM; + snacid = aim_cachesnac(sess, 0x0010, 0x0004, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x0010, 0x0004, 0x0000, snacid); + + /* Screen name */ + aimbs_put8(&fr->data, strlen(sn)); + aimbs_putraw(&fr->data, sn, strlen(sn)); + + /* Some numbers. You like numbers, right? */ + aimbs_put8(&fr->data, 0x01); + aimbs_put16(&fr->data, 0x0001); + aimbs_put8(&fr->data, 0x01); + + /* Icon string */ + aimbs_put8(&fr->data, iconcsumlen); + aimbs_putraw(&fr->data, iconcsum, iconcsumlen); + + aim_tx_enqueue(sess, fr); + + return 0; +} + +/** + * Subtype 0x0005 - Receive a buddy icon. + * + * This is sent in response to a buddy icon request. + */ +static int parseicon(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +{ + int ret = 0; + aim_rxcallback_t userfunc; + char *sn; + fu16_t flags, iconlen; + fu8_t number, iconcsumlen, *iconcsum, *icon; + + sn = aimbs_getstr(bs, aimbs_get8(bs)); + flags = aimbs_get16(bs); + number = aimbs_get8(bs); + iconcsumlen = aimbs_get8(bs); + iconcsum = aimbs_getraw(bs, iconcsumlen); + iconlen = aimbs_get16(bs); + icon = aimbs_getraw(bs, iconlen); + + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + ret = userfunc(sess, rx, sn, iconcsum, iconcsumlen, icon, iconlen); + + free(sn); + free(iconcsum); + free(icon); + + return ret; +} + +static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +{ + + if (snac->subtype == 0x0003) + return uploadack(sess, mod, rx, snac, bs); + else if (snac->subtype == 0x0005) + return parseicon(sess, mod, rx, snac, bs); + + return 0; +} + +faim_internal int bart_modfirst(aim_session_t *sess, aim_module_t *mod) +{ + + mod->family = 0x0010; + mod->version = 0x0001; + mod->toolid = 0x0010; + mod->toolversion = 0x0629; + mod->flags = 0; + strncpy(mod->name, "bart", sizeof(mod->name)); + mod->snachandler = snachandler; + + return 0; +}
--- a/src/protocols/oscar/conn.c Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/conn.c Wed Sep 17 21:19:30 2003 +0000 @@ -925,8 +925,8 @@ aim__registermodule(sess, translate_modfirst); aim__registermodule(sess, chatnav_modfirst); aim__registermodule(sess, chat_modfirst); - aim__registermodule(sess, newsearch_modfirst); - aim__registermodule(sess, icon_modfirst); + aim__registermodule(sess, odir_modfirst); + aim__registermodule(sess, bart_modfirst); /* missing 0x11 - 0x12 */ aim__registermodule(sess, ssi_modfirst); /* missing 0x14 */
--- a/src/protocols/oscar/icon.c Wed Sep 17 13:42:38 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* - * Family 0x0010 - Server stored buddy icons - * - * Used for storing and retrieving your cute little buddy icon - * from the AIM servers. - * - */ - -#define FAIM_INTERNAL -#include <aim.h> - -/** - * Subtype 0x0002 - Upload your icon. - * - * @param sess The oscar session. - * @param conn The icon connection for this session. - * @param icon The raw data of the icon image file. - * @param iconlen Length of the raw data of the icon image file. - * @return Return 0 if no errors, otherwise return the error number. - */ -faim_export int aim_icon_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !icon || !iconlen) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2+iconlen))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x0010, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0010, 0x0002, 0x0000, snacid); - - /* The reference number for the icon */ - aimbs_put16(&fr->data, 1); - - /* The icon */ - aimbs_put16(&fr->data, iconlen); - aimbs_putraw(&fr->data, icon, iconlen); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/** - * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. - * - * You get this honky after you upload a buddy icon. - */ -static int uploadack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - fu16_t something, somethingelse; - fu8_t onemorething; - - something = aimbs_get16(bs); - somethingelse = aimbs_get16(bs); - onemorething = aimbs_get8(bs); - - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx); - - return ret; -} - -/** - * Subtype 0x0004 - Request someone's icon. - * - * @param sess The oscar session. - * @param conn The icon connection for this session. - * @param sn The screen name of the person who's icon you are requesting. - * @param iconcsum The MD5 checksum of the icon you are requesting. - * @param iconcsumlen Length of the MD5 checksum given above. Should be 10 bytes. - * @return Return 0 if no errors, otherwise return the error number. - */ -faim_export int aim_icon_request(aim_session_t *sess, const char *sn, const fu8_t *iconcsum, fu16_t iconcsumlen) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0010)) || !sn || !strlen(sn) || !iconcsum || !iconcsumlen) - return -EINVAL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 1+strlen(sn) + 4 + 1+iconcsumlen))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x0010, 0x0004, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0010, 0x0004, 0x0000, snacid); - - /* Screen name */ - aimbs_put8(&fr->data, strlen(sn)); - aimbs_putraw(&fr->data, sn, strlen(sn)); - - /* Some numbers. You like numbers, right? */ - aimbs_put8(&fr->data, 0x01); - aimbs_put16(&fr->data, 0x0001); - aimbs_put8(&fr->data, 0x01); - - /* Icon string */ - aimbs_put8(&fr->data, iconcsumlen); - aimbs_putraw(&fr->data, iconcsum, iconcsumlen); - - aim_tx_enqueue(sess, fr); - - return 0; -} - -/** - * Subtype 0x0005 - Receive a buddy icon. - * - * This is sent in response to a buddy icon request. - */ -static int parseicon(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *sn; - fu16_t flags, iconlen; - fu8_t number, iconcsumlen, *iconcsum, *icon; - - sn = aimbs_getstr(bs, aimbs_get8(bs)); - flags = aimbs_get16(bs); - number = aimbs_get8(bs); - iconcsumlen = aimbs_get8(bs); - iconcsum = aimbs_getraw(bs, iconcsumlen); - iconlen = aimbs_get16(bs); - icon = aimbs_getraw(bs, iconlen); - - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, sn, iconcsum, iconcsumlen, icon, iconlen); - - free(sn); - free(iconcsum); - free(icon); - - return ret; -} - -static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) -{ - - if (snac->subtype == 0x0003) - return uploadack(sess, mod, rx, snac, bs); - else if (snac->subtype == 0x0005) - return parseicon(sess, mod, rx, snac, bs); - - return 0; -} - -faim_internal int icon_modfirst(aim_session_t *sess, aim_module_t *mod) -{ - - mod->family = 0x0010; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "icon", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -}
--- a/src/protocols/oscar/newsearch.c Wed Sep 17 13:42:38 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,245 +0,0 @@ -/* - * Family 0x000f - Newer Search Method - * - * Used for searching for other AIM users by email address, name, - * location, commmon interests, and a few other similar things. - * - */ - -#define FAIM_INTERNAL -#include <aim.h> - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM screen name based on their email address. - * - * @param sess The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param email The email address you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -faim_export int aim_usersearch_email(aim_session_t *sess, const char *region, const char *email) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region || !email) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); - aim_addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */ - aim_addtlvtochain_raw(&tl, 0x0005, strlen(email), email); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); - - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM screen name based on various info - * about the person. - * - * @param sess The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param first The first name of the person you want to search for. - * @param middle The middle name of the person you want to search for. - * @param last The last name of the person you want to search for. - * @param maiden The maiden name of the person you want to search for. - * @param nick The nick name of the person you want to search for. - * @param city The city where the person you want to search for resides. - * @param state The state where the person you want to search for resides. - * @param country The country where the person you want to search for resides. - * @param zip The zip code where the person you want to search for resides. - * @param address The street address where the person you want to seach for resides. - * @return Return 0 if no errors, otherwise return the error number. - */ -faim_export int aim_usersearch_name(aim_session_t *sess, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); - aim_addtlvtochain16(&tl, 0x000a, 0x0000); /* Type of search */ - if (first) - aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first); - if (last) - aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last); - if (middle) - aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle); - if (maiden) - aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden); - if (country) - aim_addtlvtochain_raw(&tl, 0x0006, strlen(country), country); - if (state) - aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state); - if (city) - aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city); - if (nick) - aim_addtlvtochain_raw(&tl, 0x000c, strlen(nick), nick); - if (zip) - aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip); - if (address) - aim_addtlvtochain_raw(&tl, 0x0021, strlen(address), address); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); - - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * @param sess The oscar session. - * @param interest1 An interest you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -faim_export int aim_usersearch_interest(aim_session_t *sess, const char *region, const char *interest) -{ - aim_conn_t *conn; - aim_frame_t *fr; - aim_snacid_t snacid; - aim_tlvlist_t *tl = NULL; - - if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); - aim_addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */ - if (interest) - aim_addtlvtochain_raw(&tl, 0x0001, strlen(interest), interest); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) - return -ENOMEM; - snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); - - aim_writetlvchain(&fr->data, &tl); - aim_freetlvchain(&tl); - - aim_tx_enqueue(sess, fr); - - return 0; -} - - -/** - * Subtype 0x0003 - Receive Reply From a User Search - * - */ -static int parseresults(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - fu16_t tmp, numresults; - struct aim_usersearch *results = NULL; - - tmp = aimbs_get16(bs); /* Unknown */ - tmp = aimbs_get16(bs); /* Unknown */ - aim_bstream_advance(bs, tmp); - - numresults = aimbs_get16(bs); /* Number of results to follow */ - - /* Allocate a linked list, 1 node per result */ - while (numresults) { - struct aim_usersearch *new; - aim_tlvlist_t *tl = aim_readtlvchain_num(bs, aimbs_get16(bs)); - new = (struct aim_usersearch *)malloc(sizeof(struct aim_usersearch)); - new->first = aim_gettlv_str(tl, 0x0001, 1); - new->last = aim_gettlv_str(tl, 0x0002, 1); - new->middle = aim_gettlv_str(tl, 0x0003, 1); - new->maiden = aim_gettlv_str(tl, 0x0004, 1); - new->email = aim_gettlv_str(tl, 0x0005, 1); - new->country = aim_gettlv_str(tl, 0x0006, 1); - new->state = aim_gettlv_str(tl, 0x0007, 1); - new->city = aim_gettlv_str(tl, 0x0008, 1); - new->sn = aim_gettlv_str(tl, 0x0009, 1); - new->interest = aim_gettlv_str(tl, 0x000b, 1); - new->nick = aim_gettlv_str(tl, 0x000c, 1); - new->zip = aim_gettlv_str(tl, 0x000d, 1); - new->region = aim_gettlv_str(tl, 0x001c, 1); - new->address = aim_gettlv_str(tl, 0x0021, 1); - new->next = results; - results = new; - numresults--; - } - - if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) - ret = userfunc(sess, rx, results); - - /* Now free everything from above */ - while (results) { - struct aim_usersearch *del = results; - results = results->next; - free(del->first); - free(del->last); - free(del->middle); - free(del->maiden); - free(del->email); - free(del->country); - free(del->state); - free(del->city); - free(del->sn); - free(del->interest); - free(del->nick); - free(del->zip); - free(del->region); - free(del->address); - free(del); - } - - return ret; -} - -static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) -{ - - if (snac->subtype == 0x0003) - return parseresults(sess, mod, rx, snac, bs); - - return 0; -} - -faim_internal int newsearch_modfirst(aim_session_t *sess, aim_module_t *mod) -{ - - mod->family = 0x000f; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "newsearch", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/protocols/oscar/odir.c Wed Sep 17 21:19:30 2003 +0000 @@ -0,0 +1,245 @@ +/* + * Family 0x000f - Newer Search Method + * + * Used for searching for other AIM users by email address, name, + * location, commmon interests, and a few other similar things. + * + */ + +#define FAIM_INTERNAL +#include <aim.h> + +/** + * Subtype 0x0002 - Submit a User Search Request + * + * Search for an AIM screen name based on their email address. + * + * @param sess The oscar session. + * @param region Should be "us-ascii" unless you know what you're doing. + * @param email The email address you want to search for. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_odir_email(aim_session_t *sess, const char *region, const char *email) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + aim_tlvlist_t *tl = NULL; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region || !email) + return -EINVAL; + + /* Create a TLV chain, write it to the outgoing frame, then free the chain */ + aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); + aim_addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */ + aim_addtlvtochain_raw(&tl, 0x0005, strlen(email), email); + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) + return -ENOMEM; + snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + + aim_writetlvchain(&fr->data, &tl); + aim_freetlvchain(&tl); + + aim_tx_enqueue(sess, fr); + + return 0; +} + + +/** + * Subtype 0x0002 - Submit a User Search Request + * + * Search for an AIM screen name based on various info + * about the person. + * + * @param sess The oscar session. + * @param region Should be "us-ascii" unless you know what you're doing. + * @param first The first name of the person you want to search for. + * @param middle The middle name of the person you want to search for. + * @param last The last name of the person you want to search for. + * @param maiden The maiden name of the person you want to search for. + * @param nick The nick name of the person you want to search for. + * @param city The city where the person you want to search for resides. + * @param state The state where the person you want to search for resides. + * @param country The country where the person you want to search for resides. + * @param zip The zip code where the person you want to search for resides. + * @param address The street address where the person you want to seach for resides. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_odir_name(aim_session_t *sess, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + aim_tlvlist_t *tl = NULL; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) + return -EINVAL; + + /* Create a TLV chain, write it to the outgoing frame, then free the chain */ + aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); + aim_addtlvtochain16(&tl, 0x000a, 0x0000); /* Type of search */ + if (first) + aim_addtlvtochain_raw(&tl, 0x0001, strlen(first), first); + if (last) + aim_addtlvtochain_raw(&tl, 0x0002, strlen(last), last); + if (middle) + aim_addtlvtochain_raw(&tl, 0x0003, strlen(middle), middle); + if (maiden) + aim_addtlvtochain_raw(&tl, 0x0004, strlen(maiden), maiden); + if (country) + aim_addtlvtochain_raw(&tl, 0x0006, strlen(country), country); + if (state) + aim_addtlvtochain_raw(&tl, 0x0007, strlen(state), state); + if (city) + aim_addtlvtochain_raw(&tl, 0x0008, strlen(city), city); + if (nick) + aim_addtlvtochain_raw(&tl, 0x000c, strlen(nick), nick); + if (zip) + aim_addtlvtochain_raw(&tl, 0x000d, strlen(zip), zip); + if (address) + aim_addtlvtochain_raw(&tl, 0x0021, strlen(address), address); + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) + return -ENOMEM; + snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + + aim_writetlvchain(&fr->data, &tl); + aim_freetlvchain(&tl); + + aim_tx_enqueue(sess, fr); + + return 0; +} + + +/** + * Subtype 0x0002 - Submit a User Search Request + * + * @param sess The oscar session. + * @param interest1 An interest you want to search for. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_odir_interest(aim_session_t *sess, const char *region, const char *interest) +{ + aim_conn_t *conn; + aim_frame_t *fr; + aim_snacid_t snacid; + aim_tlvlist_t *tl = NULL; + + if (!sess || !(conn = aim_conn_findbygroup(sess, 0x000f)) || !region) + return -EINVAL; + + /* Create a TLV chain, write it to the outgoing frame, then free the chain */ + aim_addtlvtochain_raw(&tl, 0x001c, strlen(region), region); + aim_addtlvtochain16(&tl, 0x000a, 0x0001); /* Type of search */ + if (interest) + aim_addtlvtochain_raw(&tl, 0x0001, strlen(interest), interest); + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+aim_sizetlvchain(&tl)))) + return -ENOMEM; + snacid = aim_cachesnac(sess, 0x000f, 0x0002, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x000f, 0x0002, 0x0000, snacid); + + aim_writetlvchain(&fr->data, &tl); + aim_freetlvchain(&tl); + + aim_tx_enqueue(sess, fr); + + return 0; +} + + +/** + * Subtype 0x0003 - Receive Reply From a User Search + * + */ +static int parseresults(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +{ + int ret = 0; + aim_rxcallback_t userfunc; + fu16_t tmp, numresults; + struct aim_odir *results = NULL; + + tmp = aimbs_get16(bs); /* Unknown */ + tmp = aimbs_get16(bs); /* Unknown */ + aim_bstream_advance(bs, tmp); + + numresults = aimbs_get16(bs); /* Number of results to follow */ + + /* Allocate a linked list, 1 node per result */ + while (numresults) { + struct aim_odir *new; + aim_tlvlist_t *tl = aim_readtlvchain_num(bs, aimbs_get16(bs)); + new = (struct aim_odir *)malloc(sizeof(struct aim_odir)); + new->first = aim_gettlv_str(tl, 0x0001, 1); + new->last = aim_gettlv_str(tl, 0x0002, 1); + new->middle = aim_gettlv_str(tl, 0x0003, 1); + new->maiden = aim_gettlv_str(tl, 0x0004, 1); + new->email = aim_gettlv_str(tl, 0x0005, 1); + new->country = aim_gettlv_str(tl, 0x0006, 1); + new->state = aim_gettlv_str(tl, 0x0007, 1); + new->city = aim_gettlv_str(tl, 0x0008, 1); + new->sn = aim_gettlv_str(tl, 0x0009, 1); + new->interest = aim_gettlv_str(tl, 0x000b, 1); + new->nick = aim_gettlv_str(tl, 0x000c, 1); + new->zip = aim_gettlv_str(tl, 0x000d, 1); + new->region = aim_gettlv_str(tl, 0x001c, 1); + new->address = aim_gettlv_str(tl, 0x0021, 1); + new->next = results; + results = new; + numresults--; + } + + if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) + ret = userfunc(sess, rx, results); + + /* Now free everything from above */ + while (results) { + struct aim_odir *del = results; + results = results->next; + free(del->first); + free(del->last); + free(del->middle); + free(del->maiden); + free(del->email); + free(del->country); + free(del->state); + free(del->city); + free(del->sn); + free(del->interest); + free(del->nick); + free(del->zip); + free(del->region); + free(del->address); + free(del); + } + + return ret; +} + +static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs) +{ + + if (snac->subtype == 0x0003) + return parseresults(sess, mod, rx, snac, bs); + + return 0; +} + +faim_internal int odir_modfirst(aim_session_t *sess, aim_module_t *mod) +{ + + mod->family = 0x000f; + mod->version = 0x0001; + mod->toolid = 0x0010; + mod->toolversion = 0x0629; + mod->flags = 0; + strncpy(mod->name, "odir", sizeof(mod->name)); + mod->snachandler = snachandler; + + return 0; +}
--- a/src/protocols/oscar/oscar.c Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/oscar.c Wed Sep 17 21:19:30 2003 +0000 @@ -3577,7 +3577,7 @@ fclose(file); gaim_debug(GAIM_DEBUG_INFO, "oscar", "Uploading icon to icon server\n"); - aim_icon_upload(od->sess, buf, st.st_size); + aim_bart_upload(od->sess, buf, st.st_size); } else gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Can't open buddy icon file!\n"); @@ -3597,7 +3597,7 @@ bi = g_hash_table_lookup(od->buddyinfo, (char *)od->requesticon->data); if (bi && (bi->iconcsumlen > 0)) { - aim_icon_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen); + aim_bart_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen); return FALSE; } else { char *sn = od->requesticon->data; @@ -4649,7 +4649,7 @@ const char *maiden, const char *city, const char *state, const char *country, const char *email) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; if (strlen(email)) - aim_usersearch_address(od->sess, od->conn, email); + aim_search_address(od->sess, od->conn, email); } static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { @@ -5569,7 +5569,7 @@ fclose(file); gaim_debug(GAIM_DEBUG_INFO, "oscar", "Uploading icon to icon server\n"); - aim_icon_upload(od->sess, buf, st.st_size); + aim_bart_upload(od->sess, buf, st.st_size); } else gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Can't open buddy icon file!\n");
--- a/src/protocols/oscar/search.c Wed Sep 17 13:42:38 2003 +0000 +++ b/src/protocols/oscar/search.c Wed Sep 17 21:19:30 2003 +0000 @@ -40,7 +40,7 @@ * Subtype 0x0002 * */ -faim_export int aim_usersearch_address(aim_session_t *sess, aim_conn_t *conn, const char *address) +faim_export int aim_search_address(aim_session_t *sess, aim_conn_t *conn, const char *address) { aim_frame_t *fr; aim_snacid_t snacid;