grim/purple-plugin-pack
--leaks
org.guifications.plugins
2009-04-15, darkrain42
* Buddy Time - Displays a buddy's local time * A libpurple plugin that allows you to configure a timezone on a per-contact * basis so it can display the localtime of your contact when a conversation * starts. Convenient if you deal with contacts from many parts of the * Copyright (C) 2006-2007, Richard Laager <rlaager@pidgin.im> * Copyright (C) 2006, Martijn van Oosterhout <kleptog@svana.org> * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA /* If you can't figure out what this line is for, DON'T TOUCH IT. */ #include "../common/pp_internal.h" #define PLUGIN_STATIC_NAME "gtkbuddytime" #define PLUGIN_ID PIDGIN_UI "-buddytime" PurplePlugin *core_plugin = NULL; buddytimezone_tooltip_cb(PurpleBlistNode * node, char **text, gboolean full, void *data) timezone = purple_plugin_ipc_call(core_plugin, BUDDYTIME_BUDDY_GET_TIMEZONE, ret = GPOINTER_TO_INT(purple_plugin_ipc_call(core_plugin, BUDDYTIME_TIMEZONE_GET_TIME, NULL, timezone, &tm, &diff)); newtext = g_strdup_printf("%s\n<b>Timezone:</b> %s (error)", *text, timezone); const char *timetext = purple_time_format(&tm); newtext = g_strdup_printf(dngettext(GETTEXT_PACKAGE, "%s\n<b>Local Time:</b> %s (%.4g hour behind)", "%s\n<b>Local Time:</b> %s (%.4g hours behind)", diff), newtext = g_strdup_printf(dngettext(GETTEXT_PACKAGE, "%s\n<b>Local Time:</b> %s (%.4g hour ahead)", "%s\n<b>Local Time:</b> %s (%.4g hours ahead)", diff), *text, timetext, diff); } plugin_load(PurplePlugin * plugin) purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip", plugin, PURPLE_CALLBACK(buddytimezone_tooltip_cb), NULL); core_plugin = purple_plugins_find_with_id(CORE_PLUGIN_ID); return (core_plugin != NULL); static PurplePluginInfo info = PURPLE_PLUGIN_STANDARD, /**< type */ PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ NULL, /**< dependencies */ PURPLE_PRIORITY_DEFAULT, /**< priority */ PP_VERSION, /**< version */ NULL, /**< description */ PLUGIN_AUTHOR, /**< author */ PP_WEBSITE, /**< homepage */ plugin_load, /**< load */ init_plugin(PurplePlugin * plugin) info.dependencies = g_list_append(info.dependencies, CORE_PLUGIN_ID); bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); info.name = _("Buddy Time (Pidgin UI)"); info.summary = _("Pidgin user interface for the Buddy Time plugin."); info.description = _("Pidgin user interface for the Buddy Time plugin."); PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info);