"Office Hours" plugin for pidgin/purple - published & linked.

Etan Reisner pidgin at unreliablesource.net
Sun Oct 18 17:32:32 EDT 2009

On Sat, Oct 03, 2009 at 07:51:39PM +0100, Kyrian wrote:
> Another problem I have hit upon is that I am not quite sure how to inject
> comments saying 'automatically logged out by office hours plugin' into an
> open conversation/window, or make a pop-up saying that all active accounts
> have been logged out, which is necessary to fulfil the 'principal of least
> astonishment' of the plugin's operation.
> I think I've found enough docs to work it out via trial and error, but any
> hints would be appreciated.

The only way to print such a message into each conversation window would
be to fetch the list of conversation windows and walk through it printing
it to each window (before disconnecting if you want to send it to the
remote party, which I would strongly recommend not doing).

I'm not sure, however, that printing such a message is actually a good
idea though. I think it likely to be better to simply create an Offline
status with a message of "After Office Hours" or something similar and
then just activating that status when the plugin fires.

> Otherwise, it seems to work a treat, including its secondary goal of
> retaining open windows (so as not to lose conversation content without
> having to use the logging plugin), as Pidgin does not close windows
> automatically when you're logged out of an account with the Perl API, which
> I realise is an undocumented 'feature', and this plugin will rely on it
> continuing to be the case, or there to be some option to allow for it in
> future.

This isn't documented because it isn't a "feature" as much as it is the
only idea that really makes any sense as the presence of a conversation
window has no relationship to whether the account is online or not.

Consider someone who had a particularly poor network connection, if pidgin
were to close a conversation window whenever an account were to get
disconnected such a person would never be able to hold a useful
conversation as there window would constantly be closing on them
(potentially even while they were typing a message).

> K.

A couple general style/etc. comments.

Callbacks added with timeout_add will repeat if you return TRUE from the
callback function, to stop them return false. I'm not sure what perl
functions return by default but you might be adding a new callback each
time your callback fires at the moment (which should all get cleaned up
correctly at unload time as the perl loader handles that for you).

As I indicated above using a custom Offline status is likely a better idea
that manually disconnecting each account (though it does require using the
Status and SavedStatus APIs which are slightly more complicated).

Correct, you need to add all necessary parent preferences before adding
the final preferences. I'll probably add some debugging messages to make
this clearer in the future (they will indicate that adding the pref failed
because the parent could not be found).

Re-using $ppref is perfectly fine the way you are using it.

In order to modify the type of an existing preference you need to remove
and re-add it.


More information about the Devel mailing list