/// <summary> /// Finds the Trillian installation path and initializes the list of available profiles. /// </summary> public TrillianProfileManager() { string trillianDir = GetTrillianDirectory(); if (trillianDir == null) { return; } string globalDir = GetGlobalDirectory(trillianDir); if (globalDir != null) { string iniPath = Path.Combine(globalDir, "profiles.ini"); var profileCount = (int)Kernel32Dll.GetPrivateProfileIntW("Profiles", "num", 0, iniPath); for (int i = 0; i < profileCount; i++) { string section = "Profile" + i.ToString("D3"); string sName = Kernel32Dll.Helpers.GetProfileString(iniPath, section, "Name", ""); if (sName.Length > 0) { var prefType = (int)Kernel32Dll.GetPrivateProfileIntW(section, "Preferences Type", 0, iniPath); var profile = new TrillianProfile(trillianDir, sName, prefType); if (profile.IsValid()) { _profiles.Add(profile); } } } } }
/** * Imports a single Trillian profile. */ private void ImportProfile(TrillianProfile profile) { _environment.ProgressWindow.UpdateProgress(0, "Importing Trillian profile " + profile.Name + "...", null); ImportBuddyGroup(profile.Buddies); string name = profile.ReadICQSetting("name"); string nick = profile.ReadICQSetting("nick name"); string firstName = profile.ReadICQSetting("first name"); string lastName = profile.ReadICQSetting("last name"); string email = profile.ReadICQSetting("email"); // The ICQ profile contains the most information that we could use to // find or create Myself contact, so we use it. If the ICQ profile was // not configured, we don't have enough data to create a useful Myself // contact anyway if it does not already exist. So simply use the (empty) // ICQ data in this case too. IContact mySelfContact = Core.ContactManager.FindOrCreateMySelfContact(email, firstName + " " + lastName); _myselfContact = mySelfContact.Resource; if (name.Length > 0) { IResource icqAccount = FindTrillianAccount("ICQ", name); if (icqAccount == null) { icqAccount = CreateTrillianAccount("ICQ", name, nick); _myselfContact.AddLink(_propTrillianAcct, icqAccount); } TrillianLog[] logs = profile.GetLogs("ICQ"); foreach (TrillianLog log in logs) { ImportLog("ICQ", log, icqAccount); } } /* * foreach( string protocol in new string[] { "ICQ", "AIM", "IRC", "MSN", "Yahoo" } ) * { * TrillianLog[] logs = profile.GetLogs( protocol ); * foreach( TrillianLog log in logs ) * { * ImportLog( protocol, log ); * } * } */ }