Autochange Buddy Icon
Matteo Landi
matteo.landi at email.it
Mon Jan 28 19:29:39 EST 2008
It's impossible!
I can find the error no way!
If i run the plugin without the ui_specs, everything works correctly apart for a "floating point exception" due to an overload during the scan phase (are there any limitations?); enabling the ui_specs, generates a complete loss of all my settings: how is it possible? I can't get it out!
Is there something wrong with these functions?
static void
init_plugin (PurplePlugin *plugin)
{
char *userdir;
userdir = (char *)purple_user_dir ();
purple_prefs_add_none (PREF_PREFIX);
purple_prefs_add_string (PREF_PATH, userdir);
purple_prefs_add_int (PREF_REFRESH, 5);
purple_prefs_add_bool (PREF_RECURSIVE, FALSE);
free (userdir);
}
static PurplePluginPrefFrame *
get_plugin_pref_frame(PurplePlugin *pPurPlu)
{
PurplePluginPrefFrame *pPurPluFra;
PurplePluginPref *pPurPluPre;
pPurPluFra = purple_plugin_pref_frame_new ();
/*PATH*/
pPurPluPre = purple_plugin_pref_new_with_name_and_label
(PREF_PATH,
"Path to
scan for the buddy icons\n(Please provide the full path)");
purple_plugin_pref_frame_add (pPurPluFra, pPurPluPre);
/*REFRESH*/
pPurPluPre = purple_plugin_pref_new_with_name_and_label
(PREF_REFRESH,
"Refresh
interval\n(in seconds)");
purple_plugin_pref_set_bounds(pPurPluPre, 5, 50);
purple_plugin_pref_frame_add (pPurPluFra, pPurPluPre);
/*RECURSIVE*/
pPurPluPre = purple_plugin_pref_new_with_name_and_label
(PREF_RECURSIVE,
"Recursive scan");
tnx in advance
M@
Ps.the problems of the blank spaces inside pathfile was simply solved
just leaving them there; no need to backslash them! ;)
On Mon, 2008-01-28 at 00:36 +0100, Matteo Landi wrote:
> Well
> i tried the purple_prefs_connect_callback function to handle the changes
> of the settings: i used it linked to the path of the settings; the fact
> is if have a string pref, everytime i digit a char, or delete it, the
> handler wake me up! Is there a way to handle the changes only when the
> user clicks on the close button?
> Trying to use the UI for the settings, i think i've messed up the whole
> thing! In fact running up pidgin with the plugin, seems to reset all the
> preferences and the accounts! Deleting the plugin and running pidgin
> again, all comes back to normality! How is it possible? Is there a way
> to delete the settings for a plugins? (/plugins/mypath/pref ?)
> Tnx in advance
> Good Nigth
> M@
> On Sun, 2008-01-27 at 16:02 -0500, Mark Doliner wrote:
> > No, the plugin will not be unloaded and loaded again. If you want to monitor
> > the status of a preference then use purple_prefs_connect_callback()
> >
> > -Mark
> >
> > On Sun, 27 Jan 2008 20:59:41 +0100, Matteo Landi wrote
> > > perfect
> > > and what about the changes of the plugin's configuration?
> > > i suppose that everytime i change something in the config dialog, the
> > > plugin is unloaded, and then loaded again..isn't it?
> > > M@
> > >
> > > On Sun, 2008-01-27 at 14:51 -0500, Mark Doliner wrote:
> > > > You should use purple_prefs_whatever() to get and set the preferences. They
> > > > will be saved to ~/.purple/prefs.xml automatically. You can look through that
> > > > file to verify, or you could just change one of the preferences from the
> > > > default then exit and restart Pidgin. The default fields are only used the
> > > > first time. i.e. they're only used if the preference does not exist in your
> > > > prefs.xml file.
> > > >
> > > > init_plugin is called only once. plugin_load is called each time the plugin
> > > > is enabled/checked. plugin_unload is called each time the plugin is
> > > > disabled/unchecked. plugin_destroy is called only once, when Pidgin exits.
> > > >
> > > > -Mark
> > > >
> > > > On Sun, 27 Jan 2008 14:21:17 +0100, Matteo Landi wrote
> > > > > well well well
> > > > > it seems i created my first pidgin plugin! Thumbs up!
> > > > > Now i'm asking you some informations about how the settings of a plugin
> > > > > are stored, and mainly, if i have to write a configuration file for
> > > > > them!
> > > > > I 've got three fiels: one for the path, one for the refresh rate,
> > > > > and the last for the use of a recursive scan! I think all my doubts
> > > > > walk around one question! Is the init_plugin function called only
> > > > > one time, or everytime pidgin is runned? Are the default fields used
> > > > > only the first time? Tnx in advance M@
> > > > >
> > > > > On Thu, 2008-01-24 at 01:09 +0100, Matteo Landi wrote:
> > > > > > well
> > > > > > first of all thanks for the answer! now the things i gonna do are more
> > > > > > clear that yesterday!
> > > > > > Actually the plugin i developed does nothing interesting, but the fact
> > > > > > that it simply "runs" is just a goal!
> > > > > > I implemented the scandir function, and before i was lookink in the
> > > > > > account.h file in order to find the functions for catching the current
> > > > > > account; here is the plan:
> > > > > > 1)purple_accounts_get_all for a list of all the accounts registered
> > > > > > 2)purple_account_get_active_status or purple_account_is_connected (which
> > > > > > one is better?) for the discovering of the account which activated the
> > > > > > plugin
> > > > > > 3)purple_buddy_icons_set_custom_icon for the renewal of the buddy icon.
> > > > > >
> > > > > > what do you think about that? tomorrow i'll try it, now it's better for
> > > > > > me to go to sleep!
> > > > > > Tnx in advance
> > > > > >
> > > > > > M@
> > > > > >
> > > > > > Ps. what about the second and the third params fo the
> > > > > > purple_buddy_icons_set_custom_icon (guchar *icon_data, size_t icon_len)?
> > > > > > how could i discover them from the pathname? .. well using the stat lib
> > > > > > the size is not so hard to discover, but what about the GUCHAR *?
> > > > > >
> > > > > > On Wed, 2008-01-23 at 02:41 -0500, Mark Doliner wrote:
> > > > > > > On Wed, 23 Jan 2008 00:38:56 +0100, Matteo Landi wrote
> > > > > > > > Hi all
> > > > > > > > i'm trying to develope a simple plugin that ask the user for a path,
> > > > > > > > and
> > > > > > > > every 10secs (it could be dynamically set), change the buddy icon!
> > > > > > > >
> > > > > > > > 1) the first approach was to modify the config file located in
> > > > > > > > ~/.purple; no usefull solution; in fact i imagine that the file is
> > > > > > > > used @ startup, so changing something inside of it, will not
> > > > > > > > generate any change!
> > > > > > >
> > > > > > > That is correct.
> > > > > > >
> > > > > > > > 2) so i decided to take a look at the pidgin source, and maybe i
> > > > > > > > found the function i gotta use:
> > > > > > > > purple_account_set_buddy_icon_path(PurpleAccount *account, const
> > > > > > > > char *path)! Is this the correct function? If so, i have also to
> > > > > > > > find the current account id isn't it?
> > > > > > >
> > > > > > > There are two functions that deal with setting the icon for an account.
> > > > > > > purple_account_set_buddy_icon_path() saves the path to the icon in your
> > > > > > > ~/.purple/accounts.xml file. The other function,
> > > > > > > purple_buddy_icons_set_account_icon(), actually sends the icon data
> > to the
> > > > > > > appropriate protocol plugin so that all your buddies will see it.
> > > > > > >
> > > > > > > You probably want to call the latter function. You may or may not
> > want to
> > > > > > > call the former function. See pidgin/gtkaccount.c for example usage,
> > > > and see
> > > > > > > http://developer.pidgin.im/doxygen/ for some documentation. You can use
> > > > > > > purple_accounts_find() to look up the appropriate PurpleAccount.
> >
>
> _______________________________________________
> Devel mailing list
> Devel at pidgin.im
> http://pidgin.im/cgi-bin/mailman/listinfo/devel
More information about the Devel
mailing list