Autochange Buddy Icon

Mark Doliner mark at kingant.net
Sun Jan 27 16:02:33 EST 2008


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.




More information about the Devel mailing list