writing and reading from files
pidgin at unreliablesource.net
Thu Jan 22 14:10:03 EST 2009
On Thu, Jan 22, 2009 at 10:18:40PM +1100, Bron Gondwana wrote:
> I'm writting this reply in vim, which was invoked by mutt by writing
> your message, pre-quoted and all no doubt, into a temporary file. When
> vim has finished editing the file, it will close, and mutt will come
> back again asking me if I want to make any further changes or just send
> the message.
> It's a pretty standard paradigm. Other programs I can think of off the
> top of my head that do this include visudo and crontab -e.
Yes, it is pretty standard for applications that work on single tasks at a
time and which block until completion of the sub-task. It does not work,
at all, for something like an IM client where people expect to be able to
have multiple conversations running at once. That is just not an
acceptable usage model for an IM client and thus an unacceptable design
model for a pidgin plugin.
> I'm not reading it that an external daemon is sitting around waiting to
> process files and dump them elsewhere. I'm reading the request as a
> plugin that launches and external process to deal with the file. Maybe
> we're at cross purposes here. Yeah, detecting file changes is hard[tm],
> though at least Windows has a recurive API for it. Linux you roll your
> own and hope you don't have a race condition in your "directory was
> added/removed" code.
That was exactly my reading of it (the external daemon reading) because it
never even entered my head to conceive of a pidgin plugin blocking on some
external application like this.
> > > Bron ( so let's try being positive about people's ideas )
> > Ethan ( so let's try being helpful )
> Well, yeah. That too :) Maybe the question showed that the asker
> didn't have a full handle on all the posibilities and the relative
> merits or otherwise of them. And indeed there may be a better way,
> but temporary files and blocking that's 99% good is heaps better for
> a lot of "me and my friends" use-cases than the perfect solution
> that never gets finished.
Again, the assumption is that blocking for an out-of-band process is not
an acceptable solution for just about anything in a pidgin plugin. There
are of course exceptions and it is up to the plugin author to understand
their problem domain well enough to make those decisions.
More information about the Devel