Mercurial > pidgin
changeset 7172:895cd1d03efb
[gaim-migrate @ 7740]
I added buddy comment support for AIM and ICQ
I also fixed a tini memleak in gaim_request_something when
using a multiline dialog.
I also tried to organize ChangeLog some. I put stuff that
I thought normal people would care about the most at the top,
and tried to group stuff aimed at plugin authors together, and
nearer to the bottom. Feel free to do a better job than me.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Oct 2003 03:21:33 +0000 |
parents | 511b4edb467c |
children | 7c43dbbb198c |
files | ChangeLog src/gtkrequest.c src/protocols/oscar/aim.h src/protocols/oscar/oscar.c src/protocols/oscar/ssi.c |
diffstat | 5 files changed, 141 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Oct 06 02:28:43 2003 +0000 +++ b/ChangeLog Mon Oct 06 03:21:33 2003 +0000 @@ -1,29 +1,32 @@ Gaim: The Pimpin' Penguin IM Clone that's good for the soul! version 0.71 - * Some plugins must be updated again (Christian) + * The right-click menu for e-mail links now presents a "Copy E-Mail + Address" item + * Fix sort by idle to behave as it did pre-contact support (David + Smock) * Display AIM away messages in the tooltip for buddies when - they are away. - * Re-write of Jabber protocol plugin - * Massive core/UI splitting. - * Conversation API changes. + they are away + * Support for Buddy Comments for AIM buddies + * Window icons are now set as buddy icons or status icons + * Get User Info in MSN and Yahoo now return an error indicating that + the information doesn't exist if the profile is empty (parts by + Nathan Poznick) + * Added startup notification support for window managers that support it. + * Zephyr formatting fixes (Arun A Tharuvai) + * Zephyr can connect to chats (Karsten Huneycutt) * SSL support can now be provided by third party plugins. - * Added startup notification support for window managers that support it. * Multiple copies of gaim installed at different locations no longer attempt to load the same, possibly incompatible plugins (Robert McQueen) - * The right-click menu for e-mail links now presents a "Copy E-Mail - Address" item. - * Zephyr formatting fixes (Arun A Tharuvai) - * Zephyr can connect to chats (Karsten Huneycutt) - * Get User Info in MSN and Yahoo now return an error indicating that - the information doesn't exist if the profile is empty (parts by - Nathan Poznick) - * Fix sort by idle to behave as it did pre-contact support (David - Smock) + * Implemented another new Yahoo! authentication method + * Massive core/UI splitting. + * Re-write of Jabber protocol plugin + * Conversation API changes. + * Some plugins must be updated due to code variable changes, + function name changes, and change of behavior for certain + functions. * Chinese (Traditional) translation updated (Ambrose C. Li) - * Implemented another new Yahoo! authentication method - * Window icons are now set as buddy icons or status icons version 0.70 (09/28/2003): * Implemented Yahoo's new authentication method (Cerulean Studios)
--- a/src/gtkrequest.c Mon Oct 06 02:28:43 2003 +0000 +++ b/src/gtkrequest.c Mon Oct 06 03:21:33 2003 +0000 @@ -71,6 +71,7 @@ input_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data) { const char *value; + char *multiline_value; if (data->u.input.multiline) { GtkTextIter start_iter, end_iter; @@ -80,8 +81,9 @@ gtk_text_buffer_get_start_iter(buffer, &start_iter); gtk_text_buffer_get_end_iter(buffer, &end_iter); - value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, + multiline_value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE); + value = multiline_value; } else value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry)); @@ -91,6 +93,9 @@ else if (data->cbs[1] != NULL) ((GaimRequestInputCb)data->cbs[1])(data->user_data, value); + if (data->u.input.multiline) + g_free(multiline_value); + gaim_request_close(GAIM_REQUEST_INPUT, data); }
--- a/src/protocols/oscar/aim.h Mon Oct 06 02:28:43 2003 +0000 +++ b/src/protocols/oscar/aim.h Mon Oct 06 03:21:33 2003 +0000 @@ -1207,6 +1207,7 @@ faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list); faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list); faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); +faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); /* Client functions for changing SSI data */ @@ -1218,6 +1219,7 @@ faim_export int aim_ssi_deldeny(aim_session_t *sess, const char *name); faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn); faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias); +faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *alias); faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn); faim_export int aim_ssi_cleanlist(aim_session_t *sess); faim_export int aim_ssi_deletelist(aim_session_t *sess);
--- a/src/protocols/oscar/oscar.c Mon Oct 06 02:28:43 2003 +0000 +++ b/src/protocols/oscar/oscar.c Mon Oct 06 03:21:33 2003 +0000 @@ -6071,11 +6071,65 @@ return m; } +static void oscar_ssi_editcomment(struct name_data *data, const char *text) { + struct oscar_data *od = data->gc->proto_data; + GaimBuddy *b; + GaimGroup *g; + + if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { + oscar_free_name_data(data); + return; + } + + if (!(g = gaim_find_buddys_group(b))) { + oscar_free_name_data(data); + return; + } + + aim_ssi_editcomment(od->sess, g->name, data->name, text); + oscar_free_name_data(data); +} + +static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { + struct oscar_data *od = gc->proto_data; + struct name_data *data = g_new(struct name_data, 1); + GaimBuddy *b; + GaimGroup *g; + char *comment; + gchar *comment_utf8; + + if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) + return; + if (!(g = gaim_find_buddys_group(b))) + return; + comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); + comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; + + data->gc = gc; + data->name = g_strdup(name); + data->nick = NULL; + + gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, + comment_utf8, TRUE, FALSE, + _("OK"), G_CALLBACK(oscar_ssi_editcomment), + _("Cancel"), G_CALLBACK(oscar_free_name_data), + data); + + free(comment); + g_free(comment_utf8); +} + static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { struct oscar_data *od = gc->proto_data; GList *m = NULL; struct proto_buddy_menu *pbm; + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Edit Buddy Comment"); + pbm->callback = oscar_buddycb_edit_comment; + pbm->gc = gc; + m = g_list_append(m, pbm); + if (od->icq) { #if 0 pbm = g_new0(struct proto_buddy_menu, 1);
--- a/src/protocols/oscar/ssi.c Mon Oct 06 02:28:43 2003 +0000 +++ b/src/protocols/oscar/ssi.c Mon Oct 06 03:21:33 2003 +0000 @@ -385,7 +385,7 @@ * @param list A pointer to the current list of items. * @param gn The group of the buddy. * @param sn The name of the buddy. - * @return A pointer to a NULL terminated string that is the buddies + * @return A pointer to a NULL terminated string that is the buddy's * alias, or NULL if the buddy has no alias. You should free * this returned value! */ @@ -405,6 +405,31 @@ } /** + * Locally find the comment of the given buddy. + * + * @param list A pointer to the current list of items. + * @param gn The group of the buddy. + * @param sn The name of the buddy. + * @return A pointer to a NULL terminated string that is the buddy's + * comment, or NULL if the buddy has no comment. You should free + * this returned value! + */ +faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn) +{ + struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, sn, AIM_SSI_TYPE_BUDDY); + if (cur) { + aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1); + if (tlv && tlv->length) { + char *alias = (char *)malloc((tlv->length+1)*sizeof(char)); + strncpy(alias, tlv->value, tlv->length); + alias[tlv->length] = 0; + return alias; + } + } + return NULL; +} + +/** * Locally find if you are waiting for authorization for a buddy. * * @param list A pointer to the current list of items. @@ -882,7 +907,7 @@ * @param gn The group that the buddy is currently in. * @param sn The screen name of the buddy. * @param alias The new alias for the buddy, or NULL if you want to remove - * a buddies alias. + * a buddy's comment. * @return Return 0 if no errors, otherwise return the error number. */ faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias) @@ -908,6 +933,38 @@ } /** + * Change the comment stored on the server for a given buddy. + * + * @param sess The oscar session. + * @param gn The group that the buddy is currently in. + * @param sn The screen name of the buddy. + * @param alias The new comment for the buddy, or NULL if you want to remove + * a buddy's comment. + * @return Return 0 if no errors, otherwise return the error number. + */ +faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *comment) +{ + struct aim_ssi_item *tmp; + + if (!sess || !gn || !sn) + return -EINVAL; + + if (!(tmp = aim_ssi_itemlist_finditem(sess->ssi.local, gn, sn, AIM_SSI_TYPE_BUDDY))) + return -EINVAL; + + /* Either add or remove the 0x0131 TLV from the TLV chain */ + if ((comment != NULL) && (strlen(comment) > 0)) + aim_tlvlist_replace_raw(&tmp->data, 0x013c, strlen(comment), comment); + else + aim_tlvlist_remove(&tmp->data, 0x013c); + + /* Sync our local list with the server list */ + aim_ssi_sync(sess); + + return 0; +} + +/** * Rename a group. * * @param sess The oscar session.