[Adium-devl] Importer API
disposable at infinitenexus.com
disposable at infinitenexus.com
Thu Apr 12 16:24:11 UTC 2007
On Apr 12, 2007, at 11:07 AM, Graham Booker wrote:
> After reading the feedback, I have a new API suggestion. Let me
> know what you think:
>
> Even though the API asks for the imported accounts and status, the
> importer actually and adds them. The array is for canceling
> purposes so that the UI can rollback the changes. Also, I liked
> Peter's suggestion of using a temp dir for the log import, so that
> is added too.
>
> //Importer's protocol
>
> typedef enum{
> IMPORT_TYPE_ACCOUNTS = 1,
> IMPORT_TYPE_STATUS = 2,
> IMPORT_TYPE_LOGS = 4
> } ImportType;
>
> @protocol ClientImporter : <NSObject>
>
> - (id)initWithUIController:(ImportUIController *)importUIController;
>
> /*
> * Import capabilites of this importer
> * @return The items from ImportType that this importer supports,
> ored together.
> */
> - (int)importCapabilities;
>
> /*
> * Import the accounts
> * @param err address of an NSError * to store the error, if there
> is one
> * @return if successfull, an NSArray containing the new accounts,
> otherwise nil
> */
> - (NSArray *)importAccounts:(NSError **)err;
>
> /*
> * Import the status messages
> * @param err address of an NSError * to store the error, if there
> is one
> * @return if successfull, an NSArray containing the new status
> messages, otherwise nil
> */
> - (NSArray *)importStatus:(NSError **)err;
>
> /*
> * Import the logs
> * This operation takes place in another thread, so be aware of
> that. Shouldn't be an
> * issue with any code design.
> * @param err address of an NSError * to store the error, if there
> is one
> * @param dir temporary directory to store the new logs
> * @return YES if successfull, NO otherwise
> */
> - (BOOL)importLogs:(NSError **)err toDirectory:(NSString *)dir;
>
> /*
> * Cancel import of the logs
> * This operation takes place in the main thread. It is suggested
> that the implementation
> * sets a boolean that the log import selector checks after each
> log. If set, the log
> * import should return when it can.
> */
> - (void)cancelLogImport;
>
> @end
>
> @interface ImporterUI
> /*
> * Sets the current progress for a progress bar
> * @param current the log number just imported
> * @param total the total number of logs
> */
> - (void)importedLog:(int)current of:(int)total;
This seems odd to me in phrasing, as it's much like the above but
doesn't actually do any importing. The display of progress may also
include a status text line which isn't accounted for. How about:
/* @param logPath the path (full or shortened) of the currently
importing file, for possible display */
-(void)updateLogProgress:(int)current outOf:(int)total forFile:
(NSString *)logPath;
> @end
>
>
>
> - Graham
>
>
> _______________________________________________
> Adium-devl mailing list
> Adium-devl at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-devl_adiumx.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070412/b266b019/attachment-0001.html>
More information about the devel
mailing list