pidgin/purple-plugin-pack

Parents 04682a4cf36f
Children 7977e92158ee
Add the ability for users to specify the Google domain to use for the search.
Done per a user request that landed in plugins.guifications.org's spam bin.
  • +2 -0
    ChangeLog
  • +38 -2
    google/google.c
  • --- a/ChangeLog Sun Dec 06 16:59:09 2009 -0500
    +++ b/ChangeLog Sun Dec 06 20:39:32 2009 -0500
    @@ -1,6 +1,8 @@
    Version 2.6.1: ??/??/??
    * Add support for limiting the number of bytes of history displayed by
    the Enhanced History plugin.
    + * Add a preference to the Google plugin to allow users to specify a
    + Google domain to use. For example, www.google.com or www.google.fr.
    * Fix the "Set User Modes On Connect" and "Unset User Modes On Connect"
    settings provided by irc-more on IRC accounts.
    * Fix Message Splitter so that it builds on Windows.
    --- a/google/google.c Sun Dec 06 16:59:09 2009 -0500
    +++ b/google/google.c Sun Dec 06 20:39:32 2009 -0500
    @@ -33,6 +33,8 @@
    #define GOOGLE_URL_FORMAT "http://%s/search?q=%s&btnI=I%%27m+Feeling+Lucky"
    +#define GOOGLE_DOMAIN_PREF "/core/plugins/core-plugin_pack-google/domain"
    +
    /******************************************************************************
    * Structs
    *****************************************************************************/
    @@ -230,8 +232,11 @@
    GoogleFetchUrlData *gfud = NULL;
    PurplePlugin *plugin = (PurplePlugin *)data;
    gchar *url = NULL;
    + const gchar *pref = NULL;
    - url = g_strdup_printf(GOOGLE_URL_FORMAT, "www.google.com",
    + pref = purple_prefs_get_string(GOOGLE_DOMAIN_PREF);
    + url = g_strdup_printf(GOOGLE_URL_FORMAT,
    + pref ? pref : "www.google.com",
    purple_url_encode(args[0]));
    gfud = google_fetch_url_data_new(url);
    g_free(url);
    @@ -256,6 +261,21 @@
    }
    /******************************************************************************
    + * Prefs Stuff
    + *****************************************************************************/
    +static PurplePluginPrefFrame *
    +google_pref_frame(PurplePlugin *plugin) {
    + PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new();
    + PurplePluginPref *pref =
    + purple_plugin_pref_new_with_name_and_label(GOOGLE_DOMAIN_PREF,
    + _("Google Domain (i.e. www.google.com)"));
    +
    + purple_plugin_pref_frame_add(frame, pref);
    +
    + return frame;
    +}
    +
    +/******************************************************************************
    * Plugin Stuff
    *****************************************************************************/
    static gboolean
    @@ -278,6 +298,16 @@
    return TRUE;
    }
    +static PurplePluginUiInfo google_prefs_info = {
    + google_pref_frame,
    + 0,
    + NULL,
    + NULL,
    + NULL,
    + NULL,
    + NULL
    +};
    +
    static PurplePluginInfo info = {
    PURPLE_PLUGIN_MAGIC,
    PURPLE_MAJOR_VERSION,
    @@ -302,7 +332,7 @@
    NULL,
    NULL,
    - NULL,
    + &google_prefs_info,
    NULL,
    NULL,
    NULL,
    @@ -320,6 +350,12 @@
    info.name = _("Google");
    info.summary = _("Returns the url for a Google \"I'm feeling lucky\" search");
    info.description = info.summary;
    +
    + purple_prefs_add_none("/core");
    + purple_prefs_add_none("/core/plugins");
    + purple_prefs_add_none("/core/plugins/core-plugin_pack-google");
    +
    + purple_prefs_add_string(GOOGLE_DOMAIN_PREF, "www.google.com");
    }
    PURPLE_INIT_PLUGIN(google, init_plugin, info)