Update of /cvsroot/mahogany/M/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv24001/src/util
Modified Files:
upgrade.cpp
Log Message:
bumped up version number to 0.66
Index: upgrade.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/upgrade.cpp,v
retrieving revision 1.209
retrieving revision 1.210
diff -b -u -2 -r1.209 -r1.210
--- upgrade.cpp 23 Jul 2003 20:09:44 -0000 1.209
+++ upgrade.cpp 29 Aug 2003 00:05:07 -0000 1.210
@@ -212,5 +212,6 @@
Version_064_2 = Version_064_1, // no changes
Version_065, // SSL flag is not boolean any more and not a flag at all
- Version_Last = Version_065,// last existing version
+ Version_066, // "/M/Profiles" -> "/Profiles"
+ Version_Last = Version_066,// last existing version
Version_Unknown // some unrecognized version
};
@@ -2135,13 +2136,9 @@
rc = false;
- Profile
- *p = Profile::CreateProfile(""),
- *p2;
+ Profile_obj p("");
kbStringList
folders;
String
group, pw, tmp;
- long
- index = 0;
// We need to rename the old mainfolder, to remove its leading slash:
@@ -2165,8 +2162,8 @@
/* Encrypt passwords in new location and make sure we have no
illegal old profiles around. */
- p->ResetPath(); // to be safe
- for ( bool ok = p->GetFirstGroup(group, index);
+ Profile::EnumData cookie;
+ for ( bool ok = p->GetFirstGroup(group, cookie);
ok ;
- ok = p->GetNextGroup(group, index))
+ ok = p->GetNextGroup(group, cookie))
{
tmp = group;
@@ -2181,17 +2178,15 @@
{
group = **i;
- p->SetPath(group);
- if( READ_CONFIG(p, MP_FOLDER_TYPE) != GetNumericDefault(MP_FOLDER_TYPE) )
- {
- p2 = Profile::CreateProfile(group);
- pw = READ_CONFIG_TEXT(p2, MP_FOLDER_PASSWORD);
- if(pw.Length()) // only if we have a password
- p2->writeEntry(MP_FOLDER_PASSWORD, strutil_encrypt(pw));
- p2->DecRef();
- p->ResetPath();
+
+ Profile_obj profile(group);
+ if( READ_CONFIG(profile, MP_FOLDER_TYPE) !=
+ GetNumericDefault(MP_FOLDER_TYPE) )
+ {
+ pw = READ_CONFIG_TEXT(profile, MP_FOLDER_PASSWORD);
+ if ( !pw.empty() )
+ profile->writeEntry(MP_FOLDER_PASSWORD, strutil_encrypt(pw));
}
else
{
- p->ResetPath();
p->DeleteGroup(group);
String msg = _("Deleted illegal folder profile: '");
@@ -2200,10 +2195,8 @@
}
}
- p->DecRef();
- //FIXME check returncodes!
+ //FIXME check returncodes!
return rc;
-
}
@@ -2799,4 +2792,24 @@
// ----------------------------------------------------------------------------
+// 0.65 -> 0.66
+// ----------------------------------------------------------------------------
+
+static bool
+UpgradeFrom065()
+{
+#ifdef OS_UNIX
+ wxConfigBase *config = mApplication->GetProfile()->GetConfig();
+
+ if ( !CopyEntries(config, "/M", "/") > 0 )
+ return false;
+
+ if ( !config->DeleteGroup("/M") )
+ wxLogDebug("Old data was left in [M] config section.");
+#endif // OS_UNIX
+
+ return true;
+}
+
+// ----------------------------------------------------------------------------
// global functions
// ----------------------------------------------------------------------------
@@ -2836,6 +2849,8 @@
else if ( version == "0.64.1" || version == "0.64.2" )
oldVersion = Version_064_1;
- else if ( version == "0.65" )
+ else if ( version == "0.65" || version == "0.65.0" )
oldVersion = Version_065;
+ else if ( version == "0.66" )
+ oldVersion = Version_066;
else
oldVersion = Version_Unknown;
@@ -2885,5 +2900,10 @@
case Version_064_1:
- if ( success && UpgradeFrom064_1() )
+ if ( success )
+ success = UpgradeFrom064_1();
+ // fall through
+
+ case Version_065:
+ if ( success && UpgradeFrom065() )
wxLogMessage(_("Configuration information and program files were "
"successfully upgraded from the version '%s'."),
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates