[Adium-devl] Importer API

Graham Booker gbooker at cod3r.com
Wed Apr 11 19:13:43 UTC 2007


On Apr 11, 2007, at 3:50 AM, Peter Hosey wrote:

> On Apr 11, 2007, at 01:16:50, Ofri Wolfus wrote:
>> easy canceling (by imply invalidating the input source or removing  
>> it temporarily from the runloop for pausing)
>
> Well, we also ought to roll back the changes.
>

OK, so if a cancel is added to the API, then the importer needs to  
know what it added and be able to remove them.  This is simple in the  
case of accounts and status messages.  It just keeps them all in an  
array, and remove them when told to cancel.

> One way would be to output the new logs to a new folder (e.g.  
> “Imported logs 2007-04-11 014838”), and when the import finishes,  
> run a subprocess that cds into the folder, makes a tar archive of  
> its contents, cds into the real Logs folder, untars the archive,  
> and unlinks the archive. Then, canceling this operation consists of  
> unlinking the archive. Whether it succeeds, fails, or is canceled,  
> it would be immediately followed by moving the folder to the Trash.

I like the idea of importing to a new folder, but I am more inclined  
to say forget the tar archive.  Instead, when the import is complete,  
then disable the cancel operation, and proceed to "move" all files in  
the temp dir to their final locations.  This avoids the time  
necessary to create the tar archive and untaring it as well.  The  
cancel here is just to move the temp dir to the trash.

Perhaps, for the API, have it pass in an NSString of a temp dir, and  
the import is done in that directory.  Then when the API call  
returns, the thread there can do the move operation.

> ___________________________________
> \ Peter Hosey / boredzo at adiumx.com
> PGP public key ID: C6550423 (since 2007-01-01)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1601 bytes
Desc: not available
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070411/88742da9/attachment.p7s>


More information about the devel mailing list