/*****************************************************************************
* update.m: MacOS X Check-For-Update window
*****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005-2007 the VideoLAN team
* $Id$
*
* Authors: Felix K\9fhne <fkuehne@users.sf.net>
/*****************************************************************************
- * Note:
- * the code used to bind with VLC's core and the download of files is heavily
- * based upon ../wxwidgets/updatevlc.cpp, written by Antoine Cellerier.
- * (he is a member of the VideoLAN team)
+ * Note: the code used to communicate with VLC's core was inspired by
+ * ../wxwidgets/dialogs/updatevlc.cpp, written by Antoine Cellerier.
*****************************************************************************/
#import "update.h"
#import "intf.h"
-#import <vlc/vlc.h>
-#import <vlc/intf.h>
-
-#import "vlc_block.h"
-#import "vlc_stream.h"
-#import "vlc_xml.h"
-
-#define UPDATE_VLC_OS "macosx"
-
-#ifdef i386
-#define UPDATE_VLC_ARCH "i386"
-#else
-#define UPDATE_VLC_ARCH "ppc"
-#endif
-
-#define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status"
-#define UPDATE_VLC_MIRRORS_URL "http://update.videolan.org/mirrors"
-
-#define UPDATE_VLC_DOWNLOAD_BUFFER_SIZE 2048
+static NSString * kPrefUpdateOnStartup = @"UpdateOnStartup";
+static NSString * kPrefUpdateLastTimeChecked = @"UpdateLastTimeChecked";
/*****************************************************************************
* VLCExtended implementation
- (id)init
{
- if (_o_sharedInstance) {
+ if( _o_sharedInstance ) {
[self dealloc];
} else {
_o_sharedInstance = [super init];
- (void)awakeFromNib
{
+ /* get up */
+ p_intf = VLCIntf;
+
/* clean the interface */
- [o_fld_userVersion setStringValue: [[[NSBundle mainBundle] infoDictionary] \
- objectForKey:@"CFBundleVersion"]];
[o_fld_releaseNote setString: @""];
- [o_fld_size setStringValue: @""];
- [o_fld_currentVersion setStringValue: @""];
-
- [self initStrings];
+
+ [self initInterface];
+}
+
+- (void)dealloc
+{
+ if( o_urlOfBinary )
+ [o_urlOfBinary release];
+
+ [super dealloc];
}
-- (void)initStrings
+- (void)initInterface
{
/* translate strings to the user's language */
- [o_update_window setTitle: _NS("Check for update")];
- [o_btn_cancel setTitle: _NS("Cancel")];
+ [o_update_window setTitle: _NS("Check for Updates")];
[o_btn_DownloadNow setTitle: _NS("Download now")];
[o_btn_okay setTitle: _NS("OK")];
- [o_lbl_currentVersion setStringValue: [_NS("Current version") \
- stringByAppendingString: @":"]];
- [o_lbl_size setStringValue: [_NS("Size") \
- stringByAppendingString: @":"]];
- [o_lbl_userVersion setStringValue: [_NS("Your version") \
- stringByAppendingString: @":"]];
- [o_lbl_mirror setStringValue: [_NS("Mirror") \
- stringByAppendingString: @":"]];
- [o_lbl_checkForUpdate setStringValue: _NS("Checking for update...")];
+ [o_chk_updateOnStartup setTitle: _NS("Automatically check for updates")];
+ /* we don't use - (BOOL)shouldCheckUpdateOnStartup because we don't want the Alert
+ * panel to pop up at this time */
+ [o_chk_updateOnStartup setState: [[NSUserDefaults standardUserDefaults] boolForKey: kPrefUpdateOnStartup]];
+}
+
+- (void)setShouldCheckUpdate: (BOOL)check
+{
+ [[NSUserDefaults standardUserDefaults] setBool: check forKey: kPrefUpdateOnStartup];
+ [o_chk_updateOnStartup setState: check];
+}
+
+- (BOOL)shouldCheckForUpdate
+{
+ NSDate *o_last_update;
+ NSDate *o_next_update;
+
+ if( ![[NSUserDefaults standardUserDefaults] objectForKey: kPrefUpdateOnStartup] )
+ {
+ /* We don't have any preferences stored, ask the user. */
+ int res = NSRunInformationalAlertPanel( _NS("Do you want VLC to check for updates automatically?"),
+ _NS("You can change this option in VLC's update window later on."), _NS("Yes"), _NS("No"), nil );
+ [self setShouldCheckUpdate: res];
+ }
+
+ if( ![[NSUserDefaults standardUserDefaults] boolForKey: kPrefUpdateOnStartup] )
+ return NO;
+
+ o_last_update = [[NSUserDefaults standardUserDefaults] objectForKey: kPrefUpdateLastTimeChecked];
+ if( !o_last_update )
+ return YES;
+
+ o_next_update = [[[NSDate alloc] initWithTimeInterval: 60*60*24*2 /* every two days */ sinceDate: o_last_update] autorelease];
+ if( !o_next_update )
+ return YES;
+
+ return [o_next_update compare: [NSDate date]] == NSOrderedAscending;
}
- (void)showUpdateWindow
{
/* show the window and check for a potential update */
+ [o_fld_status setStringValue: _NS("Checking for Updates...")];
+ [o_fld_currentVersionAndSize setStringValue: @""];
+ [o_fld_releaseNote setString: @""];
+
[o_update_window center];
[o_update_window displayIfNeeded];
[o_update_window makeKeyAndOrderFront:nil];
-
- /* alloc some dictionaries first */
- o_mirrors = [[NSMutableArray alloc] init];
- o_files = [[NSMutableDictionary alloc] init];
-
- [o_bar_checking startAnimation:nil];
- [self getData];
- [o_bar_checking stopAnimation:nil];
+
+ [o_bar_checking startAnimation: self];
+ [self checkForUpdate];
+ [o_bar_checking stopAnimation: self];
}
-- (IBAction)cancel:(id)sender
+- (IBAction)download:(id)sender
{
- /* cancel the download and close the sheet */
+ /* provide a save dialogue */
+ SEL sel = @selector(getLocationForSaving:returnCode:contextInfo:);
+ NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
+
+ [saveFilePanel setRequiredFileType: @"dmg"];
+ [saveFilePanel setCanSelectHiddenExtension: YES];
+ [saveFilePanel setCanCreateDirectories: YES];
+ [saveFilePanel beginSheetForDirectory:nil file: \
+ [[o_urlOfBinary componentsSeparatedByString:@"/"] lastObject] \
+ modalForWindow: o_update_window modalDelegate:self didEndSelector:sel \
+ contextInfo:nil];
}
-- (IBAction)download:(id)sender
+- (void)getLocationForSaving: (NSSavePanel *)sheet returnCode: \
+ (int)returnCode contextInfo: (void *)contextInfo
{
- /* open the sheet and start the download */
+ if( returnCode == NSOKButton )
+ {
+ /* perform download and pass the selected path */
+ [self performDownload: [sheet filename]];
+ }
+ [sheet release];
}
- (IBAction)okay:(id)sender
[o_update_window close];
}
-
-
-- (void)getData
+- (IBAction)changeCheckUpdateOnStartup:(id)sender
{
- /* This function gets all the info from the xml files hosted on
- http://update.videolan.org/ and stores it in appropriate lists.
- It was taken from the WX-interface and ported from C++ to Obj-C. */
-
- stream_t *p_stream = NULL;
- char *psz_eltname = NULL;
- char *psz_name = NULL;
- char *psz_value = NULL;
- char *psz_eltvalue = NULL;
- xml_t *p_xml = NULL;
- xml_reader_t *p_xml_reader = NULL;
- bool b_os = false;
- bool b_arch = false;
-
- intf_thread_t * p_intf = VLCIntf;
-
- if( UPDATE_VLC_ARCH == "i386" )
- {
- /* since we don't provide any binaries for MacTel atm, doing the
- * update-check is not necessary (this would fail in fact). That's why
- * we just provide a sheet telling the user about that and skip
- * the rest. */
- /* FIXME: remove me, if a i386-binary is available */
- NSBeginInformationalAlertSheet(_NS("Unsupported architecture"), \
- _NS("OK"), @"", @"", o_update_window, nil, nil, nil, nil, \
- _NS("Binary builds are only available for Mac OS X on " \
- "the PowerPC-platform. Official builds for Intel-Macs " \
- "are not available at this time. \n\n If you want to " \
- "help us here, feel free to contact us."));
- return;
- }
-
- NSMutableDictionary * temp_version;
- temp_version = [[NSMutableDictionary alloc] init];
- NSMutableDictionary * temp_file;
- temp_file = [[NSMutableDictionary alloc] init];
- NSMutableDictionary * temp_mirror;
- temp_mirror = [[NSMutableDictionary alloc] init];
-
- //struct update_mirror_t tmp_mirror;
-
- p_xml = xml_Create( p_intf );
- if( !p_xml )
- {
- msg_Err( p_intf, "Failed to open XML parser" );
- // FIXME: display error message in dialog
- return;
- }
-
- p_stream = stream_UrlNew( p_intf, UPDATE_VLC_STATUS_URL );
- if( !p_stream )
- {
- msg_Err( p_intf, "Failed to open %s for reading",
- UPDATE_VLC_STATUS_URL );
- // FIXME: display error message in dialog
- return;
- }
-
- p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
-
- if( !p_xml_reader )
- {
- msg_Err( p_intf, "Failed to open %s for parsing",
- UPDATE_VLC_STATUS_URL );
- // FIXME: display error message in dialog
- return;
- }
+ [self setShouldCheckUpdate: [sender state]];
+}
- /* build tree */
- while( xml_ReaderRead( p_xml_reader ) == 1 )
+- (void)checkForUpdate
+{
+ /* We may not run on first thread */
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ p_u = update_New( p_intf );
+ update_Check( p_u, VLC_FALSE );
+ update_iterator_t *p_uit = update_iterator_New( p_u );
+ BOOL releaseChecked = NO;
+ BOOL gettingReleaseNote = NO;
+ int x = 0;
+ NSString * pathToReleaseNote;
+ pathToReleaseNote = [NSString stringWithFormat: \
+ @"/tmp/vlc_releasenote_%d.tmp", mdate()];
+
+ [[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: kPrefUpdateLastTimeChecked];
+
+ if( p_uit )
{
- switch( xml_ReaderNodeType( p_xml_reader ) )
+ p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER;
+ p_uit->i_t = UPDATE_FILE_TYPE_ALL;
+ update_iterator_Action( p_uit, UPDATE_MIRROR );
+
+ while( update_iterator_Action( p_uit, UPDATE_FILE) != UPDATE_FAIL )
{
- // Error
- case -1:
- // TODO: print message
- return;
-
- case XML_READER_STARTELEM:
- psz_eltname = xml_ReaderName( p_xml_reader );
- if( !psz_eltname )
+ msg_Dbg( p_intf, "parsing available updates, run %i", x );
+ /* if the announced item is of the type "binary", keep it and display
+ * its details to the user. Do similar stuff on "info". Do both
+ * only if the file is announced as stable */
+ if( p_uit->release.i_type == UPDATE_RELEASE_TYPE_STABLE )
+ {
+ if( p_uit->file.i_type == UPDATE_FILE_TYPE_INFO )
{
- // TODO: print message
- return;
+ msg_Dbg( p_intf, "release note found, desc = %s",
+ p_uit->file.psz_description );
+ [o_fld_releaseNote setString: \
+ [NSString stringWithUTF8String: \
+ (p_uit->file.psz_description)]];
+ /* download our release note
+ * We will read the temp file after this loop */
+ update_download( p_uit, (char *)[pathToReleaseNote UTF8String] );
+ gettingReleaseNote = YES;
}
- msg_Dbg( p_intf, "element name: %s", psz_eltname );
- while( xml_ReaderNextAttr( p_xml_reader ) == VLC_SUCCESS )
+ else if( p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY )
{
- psz_name = xml_ReaderName( p_xml_reader );
- psz_value = xml_ReaderValue( p_xml_reader );
- if( !psz_name || !psz_value )
- {
- // TODO: print message
- free( psz_eltname );
- return;
- }
- msg_Dbg( p_intf, " attribute %s = %s",
- psz_name, psz_value );
-
- if( !strcmp( psz_name, "name" )
- && ( !strcmp( psz_value, "macosx" )
- || !strcmp( psz_value, "*" ) )
- && !strcmp( psz_eltname, "os" ) )
- {
- b_os = true;
- }
- if( b_os && !strcmp( psz_name, "name" )
- && ( !strcmp( psz_value, UPDATE_VLC_ARCH )
- || !strcmp( psz_value, "*" ) )
- && !strcmp( psz_eltname, "arch" ) )
- {
- b_arch = true;
- }
-
- if( b_os && b_arch )
- {
- if( strcmp( psz_eltname, "version" ) == 0 )
- {
- [temp_version setObject: [NSString \
- stringWithUTF8String: psz_value] forKey: \
- [NSString stringWithUTF8String: psz_name]];
- }
- if( !strcmp( psz_eltname, "file" ) )
- {
- [temp_file setObject: [NSString \
- stringWithUTF8String: psz_value] forKey: \
- [NSString stringWithUTF8String: psz_name]];
- }
- }
- free( psz_name );
- free( psz_value );
+ msg_Dbg( p_intf, "binary found, version = %s, " \
+ "url=%s, size=%i MB", p_uit->release.psz_version, \
+ p_uit->file.psz_url, \
+ (int)((p_uit->file.l_size / 1024) / 1024) );
+ [o_fld_currentVersionAndSize setStringValue: [NSString \
+ stringWithFormat: \
+ _NS("The latest VLC media player release " \
+ "is %s (%i MB to download)."), \
+ p_uit->release.psz_version, ((p_uit->file.l_size \
+ / 1024) / 1024)]];
+
+ if( o_urlOfBinary )
+ [o_urlOfBinary release];
+ o_urlOfBinary = [[NSString alloc] initWithUTF8String: \
+ p_uit->file.psz_url];
}
- if( ( b_os && b_arch && strcmp( psz_eltname, "arch" ) ) )
+ if( p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER &&
+ !releaseChecked )
{
- /*if( !strcmp( psz_eltname, "version" ) )
- {
- it = m_versions.begin();
- while( it != m_versions.end() )
- {
- if( it->type == tmp_version.type
- && it->major == tmp_version.major
- && it->minor == tmp_version.minor
- && it->revision == tmp_version.revision
- && it->extra == tmp_version.extra )
- {
- break;
- }
- it++;
- }
- if( it == m_versions.end() )
- {
- m_versions.push_back( tmp_version );
- it = m_versions.begin();
- while( it != m_versions.end() )
- {
- if( it->type == tmp_version.type
- && it->major == tmp_version.major
- && it->minor == tmp_version.minor
- && it->revision == tmp_version.revision
- && it->extra == tmp_version.extra )
- {
- break;
- }
- it++;
- }
- }
- tmp_version.type = wxT( "" );
- tmp_version.major = wxT( "" );
- tmp_version.minor = wxT( "" );
- tmp_version.revision = wxT( "" );
- tmp_version.extra = wxT( "" );
- }
- if( !strcmp( psz_eltname, "file" ) )
- {
- it->m_files.push_back( tmp_file );
- tmp_file.type = wxT( "" );
- tmp_file.md5 = wxT( "" );
- tmp_file.size = wxT( "" );
- tmp_file.url = wxT( "" );
- tmp_file.description = wxT( "" );
- }*/
-
- if(! [temp_version objectForKey: @"extra"] == @"0")
- {
- [o_fld_currentVersion setStringValue: [NSString \
- stringWithFormat: @"%@.%@.%@-%@ (%@)", \
- [temp_version objectForKey: @"major"], \
- [temp_version objectForKey: @"minor"], \
- [temp_version objectForKey: @"revision"], \
- [temp_version objectForKey: @"extra"], \
- [temp_version objectForKey: @"type"]]];
- }
- else
- {
- [o_fld_currentVersion setStringValue: [NSString \
- stringWithFormat: @"%@.%@.%@ (%@)", \
- [temp_version objectForKey: @"major"], \
- [temp_version objectForKey: @"minor"], \
- [temp_version objectForKey: @"revision"], \
- [temp_version objectForKey: @"type"]]];
- }
- }
- free( psz_eltname );
- break;
+ /* our version is outdated, let the user download the new
+ * release */
+ [o_fld_status setStringValue: _NS("This version of VLC " \
+ "is outdated.")];
+ [o_btn_DownloadNow setEnabled: YES];
+ msg_Dbg( p_intf, "this version of VLC is outdated" );
+ /* put the mirror information */
+ msg_Dbg( p_intf, "used mirror: %s, %s [%s]", \
+ p_uit->mirror.psz_name, p_uit->mirror.psz_location,\
+ p_uit->mirror.psz_type );
+ /* make sure that we perform this check only once */
+ releaseChecked = YES;
+ /* Make sure the update window is showed in case we have something */
+ [o_update_window center];
+ [o_update_window displayIfNeeded];
+ [o_update_window makeKeyAndOrderFront: self];
- case XML_READER_ENDELEM:
- psz_eltname = xml_ReaderName( p_xml_reader );
- if( !psz_eltname )
- {
- // TODO: print message
- return;
}
- msg_Dbg( p_intf, "element end: %s", psz_eltname );
- if( !strcmp( psz_eltname, "os" ) )
- b_os = false;
- if( !strcmp( psz_eltname, "arch" ) )
- b_arch = false;
-
- if( !strcmp( psz_eltname, "file") )
+ else if(! releaseChecked )
{
- if( [temp_file objectForKey: @"type"] == @"info" )
- {
- /* this is the announce file, store it correctly */
- [o_files setObject: temp_file forKey: @"announce"];
- }
- else if( [temp_file objectForKey: @"type"] == @"binary" )
- {
- /* that's our binary */
- [o_files setObject: temp_file forKey: @"binary"];
- }
- else if( [temp_file objectForKey: @"type"] == @"source" )
- {
- /* that's the source. not needed atm, but store it
- * anyway to make possible enhancement of this dialogue
- * a bit easier */
- [o_files setObject: temp_file forKey: @"source"];
- }
-
- /* clean the temp-dict */
- [temp_file removeAllObjects];
+ [o_fld_status setStringValue: _NS("This version of VLC " \
+ "is the latest available.")];
+ [o_btn_DownloadNow setEnabled: NO];
+ msg_Dbg( p_intf, "current version is up-to-date" );
+ releaseChecked = YES;
}
- free( psz_eltname );
- break;
-
- case XML_READER_TEXT:
- /* you can check the content of a file here (e.g. \
- * "Installer-less binaries", "Disk-Image", etc.). That's not
- * needed on OSX atm, but print debug-info anyway. */
- psz_eltvalue = xml_ReaderValue( p_xml_reader );
- msg_Dbg( p_intf, " text: %s", psz_eltvalue );
- free( psz_eltvalue );
- break;
+ }
+ x += 1;
}
- }
- if( p_xml_reader && p_xml ) xml_ReaderDelete( p_xml, p_xml_reader );
- if( p_stream ) stream_Delete( p_stream );
+ update_iterator_Delete( p_uit );
- p_stream = stream_UrlNew( p_intf, UPDATE_VLC_MIRRORS_URL );
- if( !p_stream )
- {
- msg_Err( p_intf, "Failed to open %s for reading",
- UPDATE_VLC_MIRRORS_URL );
- // FIXME: display error message in dialog
- return;
- }
-
- p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
-
- if( !p_xml_reader )
- {
- msg_Err( p_intf, "Failed to open %s for parsing",
- UPDATE_VLC_MIRRORS_URL );
- // FIXME: display error message in dialog
- return;
- }
-
- /* build list */
- while( xml_ReaderRead( p_xml_reader ) == 1 )
- {
- switch( xml_ReaderNodeType( p_xml_reader ) )
+ /* wait for our release notes if necessary, since the download is done
+ * by another thread -- this does usually take 300000 to 500000 ms */
+ if( gettingReleaseNote )
{
- // Error
- case -1:
- // TODO: print message
- return;
-
- case XML_READER_STARTELEM:
- psz_eltname = xml_ReaderName( p_xml_reader );
- if( !psz_eltname )
- {
- // TODO: print message
- return;
- }
- msg_Dbg( p_intf, "element name: %s", psz_eltname );
- while( xml_ReaderNextAttr( p_xml_reader ) == VLC_SUCCESS )
+ int i = 0;
+ while( [[NSFileManager defaultManager] fileExistsAtPath: pathToReleaseNote] == NO )
+ {
+ msleep( 100000 );
+ i += 1;
+ if( i == 150 )
{
- psz_name = xml_ReaderName( p_xml_reader );
- psz_value = xml_ReaderValue( p_xml_reader );
- if( !psz_name || !psz_value )
- {
- // TODO: print message
- free( psz_eltname );
- return;
- }
- msg_Dbg( p_intf, " attribute %s = %s",
- psz_name, psz_value );
-
- if( !strcmp( psz_eltname, "mirror" ) )
- {
- [temp_mirror setObject: [NSString stringWithUTF8String: psz_name] forKey: [NSString stringWithUTF8String: psz_value]];
-
- /*if( !strcmp( psz_name, "name" ) )
- tmp_mirror.name = wxU( psz_value );
- if( !strcmp( psz_name, "location" ) )
- tmp_mirror.location = wxU( psz_value );*/
- }
- if( !strcmp( psz_eltname, "url" ) )
- {
- [temp_mirror setObject: [NSString stringWithUTF8String: psz_name] forKey: [NSString stringWithUTF8String: psz_value]];
-
- /*
- if( !strcmp( psz_name, "type" ) )
- tmp_mirror.type = wxU( psz_value );
- if( !strcmp( psz_name, "base" ) )
- tmp_mirror.base_url = wxU( psz_value );*/
- }
- free( psz_name );
- free( psz_value );
+ /* if this takes more than 15 sec, exit */
+ msg_Warn( p_intf, "download took more than 15 sec, exiting" );
+ break;
}
- /*if( !strcmp( psz_eltname, "url" ) )
- {
- m_mirrors.push_back( tmp_mirror );
- tmp_mirror.type = wxT( "" );
- tmp_mirror.base_url = wxT( "" );
- }*/
- free( psz_eltname );
- break;
-
- case XML_READER_ENDELEM:
- psz_eltname = xml_ReaderName( p_xml_reader );
- if( !psz_eltname )
- {
- // TODO: print message
- return;
- }
- msg_Dbg( p_intf, "element end: %s", psz_eltname );
- /*if( !strcmp( psz_eltname, "mirror" ) )
- {
- tmp_mirror.name = wxT( "" );
- tmp_mirror.location = wxT( "" );
- }*/
-
- /* store our mirror correctly */
- [o_mirrors addObject: temp_mirror];
- [temp_mirror removeAllObjects];
-
- free( psz_eltname );
- break;
-
- case XML_READER_TEXT:
- psz_eltvalue = xml_ReaderValue( p_xml_reader );
- msg_Dbg( p_intf, " text: %s", psz_eltvalue );
- free( psz_eltvalue );
- break;
+ }
+ msg_Dbg( p_intf, "waited %i ms for the release notes", (i * 100000) );
+ msleep( 500000 );
+
+ /* let's open our cached release note and display it
+ * we can't use NSString stringWithContentsOfFile:encoding:error:
+ * since it is Tiger only */
+ NSString * releaseNote = [[NSString alloc] initWithData: \
+ [NSData dataWithContentsOfFile: pathToReleaseNote] \
+ encoding: NSISOLatin1StringEncoding];
+ if( releaseNote )
+ [o_fld_releaseNote setString: releaseNote];
+
+ /* delete the file since it isn't needed anymore */
+ BOOL myBOOL = NO;
+ myBOOL = [[NSFileManager defaultManager] removeFileAtPath: \
+ pathToReleaseNote handler: nil];
+ }
+ else
+ {
+ /* don't confuse the user, but make her happy */
+ [o_fld_status setStringValue: _NS("This version of VLC " \
+ "is the latest available.")];
+ [o_btn_DownloadNow setEnabled: NO];
+ msg_Dbg( p_intf, "current version is up-to-date" );
}
}
+ [pool release];
+}
+
+- (void)performDownload:(NSString *)path
+{
+ update_iterator_t *p_uit = update_iterator_New( p_u );
+ if( p_uit )
+ {
+ update_iterator_Action( p_uit, UPDATE_MIRROR );
+ while( update_iterator_Action( p_uit, UPDATE_FILE) != UPDATE_FAIL )
+ {
+ if( p_uit->release.i_type == UPDATE_RELEASE_TYPE_STABLE &&
+ p_uit->release.i_status == UPDATE_RELEASE_STATUS_NEWER &&
+ p_uit->file.i_type == UPDATE_FILE_TYPE_BINARY )
+ {
+ /* put the mirror information */
+ msg_Dbg( p_intf, "used mirror: %s, %s [%s]", \
+ p_uit->mirror.psz_name, p_uit->mirror.psz_location, \
+ p_uit->mirror.psz_type );
+
+ /* that's our binary */
+ update_download( p_uit, (char *)[path UTF8String] );
+ }
+ }
+
+ update_iterator_Delete( p_uit );
+ }
- if( p_xml_reader && p_xml ) xml_ReaderDelete( p_xml, p_xml_reader );
- if( p_stream ) stream_Delete( p_stream );
- if( p_xml ) xml_Delete( p_xml );
+ [o_update_window close];
}
@end