[Thread Prev][Thread Next][Thread Index]

[PATCH] restore userName and userID after hard reset



Hi,

I recently discovered, that PilotManager doesn't restore the userID if I 
resync my reset Pilot. I rather computes a new one. This creates problems with 
at least SyncPlan which relies on the userID.
So I added this code (patch attached) to PilotManager which asks the user if 
he wants to restore the old name and id if a reset unit is discovered.
This may not be The Right Thing(TM), so feel free to correct it...

Alan, feel free to include this into your next release :-)

cu, Bodo
--- PilotManager.OLD	Tue Feb 16 22:42:35 1999
+++ PilotManager	Tue Feb 16 22:53:02 1999
@@ -2165,6 +2165,30 @@
 		  "need to restore your databases from your backups using ".
 		  "the Installer conduit.");
 
+	if (exists($PREFS->{"userinfo"}))
+	{
+	    # Ask user whether to restore a reset unit
+
+		my ($ans) = 
+		&askUser("PilotManager thinks, your Pilot is\n\n\t".
+			 "'$PREFS->{userinfo}->{name}'".
+			 "\n\tUnique ID: $PREFS->{userinfo}->{userID}\n\n".
+			 "If you want to restore this information, ".
+			 "click 'Restore'. However, be ".
+			 "warned that if you sync somebody else\'s Pilot ".
+			 "with your PilotManager configuration very bad ".
+			 "things will happen!\n".
+			 "If you want to provide a new name or this is your ".
+			 "first Sync with this unit, click 'New name'",
+			 "Restore", "New name");
+
+	    if ($ans eq "Restore")
+	    {
+		$userInfo->{"name"} = $PREFS->{userinfo}->{name};
+		$userInfo->{"userID"} = $PREFS->{userinfo}->{userID};
+	    }
+	}
+
 	# Trigger all conduits to do a full sync.
 	#
 	$userInfo->{"successfulSyncDate"} = 0;
Bodo Bellut          bodo@xxxxxxxxxxxxxxxx   |     USE PGP!       +-----------+
Klosterstr. 7                                | (key via server    |\  O---m  /|
44135 Dortmund       Fon: +49-231-5860337    |  or on request)    |/---------\|
PGP: 768/FA18A639 AE 5A 47 40 5A A0 D6 15  8E 54 44 AA 8D DD 6E BD+-----------+

SourceForge.net Logo