From: Sean E. <sea...@us...> - 2003-03-12 06:37:43
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1:/tmp/cvs-serv9713/src Modified Files: buddy.c prpl.h Log Message: Provided a generic way for prpls to put text in the second line of the Big List and removed a hideous Yahoo! buddy menu hack in the process Index: buddy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy.c,v retrieving revision 1.420 retrieving revision 1.421 diff -u -d -r1.420 -r1.421 --- buddy.c 12 Mar 2003 02:27:28 -0000 1.420 +++ buddy.c 12 Mar 2003 06:37:39 -0000 1.421 @@ -545,12 +545,14 @@ { char *name = gaim_get_buddy_alias(b); char *esc = g_markup_escape_text(name, strlen(name)), *text = NULL; + struct prpl* prpl = find_prpl(b->account->protocol); + /* XXX Clean up this crap */ int ihrs, imin; - char *idletime = ""; - char *warning = idletime; - time_t t; + char *idletime = NULL, *warning = NULL; + const char *statustext = NULL; + time_t t; if (!(blist_options & OPT_BLIST_SHOW_ICONS)) { if (b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS) { @@ -567,27 +569,39 @@ ihrs = (t - b->idle) / 3600; imin = ((t - b->idle) / 60) % 60; + if (prpl->status_text) { + char *tmp = prpl->status_text(b); + if (tmp) + statustext = g_markup_escape_text(tmp, strlen(tmp)); + } + if (b->idle) { if (ihrs) idletime = g_strdup_printf(_("Idle (%dh%02dm)"), ihrs, imin); else idletime = g_strdup_printf(_("Idle (%dm)"), imin); } - + if (b->evil > 0) warning = g_strdup_printf(_("Warned (%d%%)"), b->evil); - + if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) - text = g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s %s</span>", + text = g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s %s %s</span>", esc, - idletime, warning); + statustext != NULL ? statustext : "", + idletime != NULL ? idletime : "", + warning != NULL ? warning : ""); else - text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s %s</span>", esc, idletime, warning); - - if (idletime[0]) + text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s %s %s</span>", esc, + statustext != NULL ? statustext : "", + idletime != NULL ? idletime : "", + warning != NULL ? warning : ""); + if (idletime) g_free(idletime); - if (warning[0]) + if (warning) g_free(warning); + if (statustext) + g_free(statustext); return text; } Index: prpl.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/prpl.h,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- prpl.h 10 Mar 2003 05:30:24 -0000 1.92 +++ prpl.h 12 Mar 2003 06:37:40 -0000 1.93 @@ -190,6 +190,12 @@ * interpret and display as relevant */ void (* list_emblems)(struct buddy *buddy, char **se, char **sw, char **nw, char **ne); + + /** + * Gets a short string representing this buddy's status. This will be shown + * on the buddy list. + */ + const char *(* status_text)(struct buddy *buddy); GList *(* away_states)(struct gaim_connection *gc); GList *(* actions)(struct gaim_connection *gc); |