From: <che...@us...> - 2007-06-22 18:16:27
|
Revision: 599 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=599&view=rev Author: chef_koch Date: 2007-06-22 11:16:25 -0700 (Fri, 22 Jun 2007) Log Message: ----------- small cleanup Modified Paths: -------------- trunk/plugins/FritzBox/FritzBox/FritzBox.cs Modified: trunk/plugins/FritzBox/FritzBox/FritzBox.cs =================================================================== --- trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 18:03:18 UTC (rev 598) +++ trunk/plugins/FritzBox/FritzBox/FritzBox.cs 2007-06-22 18:16:25 UTC (rev 599) @@ -79,7 +79,7 @@ #region public Variables - public const string _version = "0.2.2.0"; + public const string _version = "0.2.2.8"; public static int _lastVersion = 0; public static bool _extensiveLogging = false; @@ -98,14 +98,17 @@ #endregion #region Constructors/Destructors + public FritzBox() { } + #endregion #region Private Methods #region Settings + private void LoadSettings() { char[] charSeparators = new char[] { ';' }; @@ -177,9 +180,11 @@ SavePhonebook(); } + #endregion #region Phonebook + public static void LoadPhonebook() { if ((_lastVersion < 0220) && (!File.Exists(Config.GetFile(Config.Dir.Config, "fritzbox.xml")))) @@ -306,6 +311,7 @@ } return false; } + #endregion public bool IsFritzBoxConnected(string fritzBoxAddress, string fritzBoxPort) @@ -326,6 +332,7 @@ } #region FritzBoxActions + private void OnFritzBoxEvent(string dataStream) { if (!_showNotify) @@ -382,84 +389,79 @@ Log.Info(" MSN: {0}", msn); } - if (CheckMSN(msn) == true) + if (!CheckMSN(msn)) return; + + if (callerId == "") { - if (callerId == "") + Log.Info("Caller is not identified by CLIP."); + + if (FritzBox._showUnknownCaller) + DialogOnIncomingCall("", msn); + } + else + { + if (FritzBox._usePhonebook) { - Log.Info("Caller is not identified by CLIP."); + bool foundCaller = false; - if (FritzBox._showUnknownCaller) - DialogOnIncomingCall("", msn); - } - else - { - if (FritzBox._usePhonebook) + if (phonebook.Count == 0) { + Log.Info("Phonebook is empty. Caller is added to the phonebook."); + Caller caller = new Caller(callerId, callerId, true); + phonebook.Add(caller); + } + else + { + int i = 0; - - - - bool foundCaller = false; - - if (phonebook.Count == 0) + do { - Log.Info("Phonebook is empty. Caller is added to the phonebook."); - Caller caller = new Caller(callerId, callerId, true); - phonebook.Add(caller); - } - else - { - int i = 0; + Caller caller = phonebook[i]; - do + if (caller.ID.Equals(callerId)) { - Caller caller = phonebook[i]; + Log.Info("Caller is identified by phonebook as {0}.", caller.Name); + foundCaller = true; - if (caller.ID.Equals(callerId)) + if (caller.Show) { - Log.Info("Caller is identified by phonebook as {0}.", caller.Name); - foundCaller = true; + Log.Info("Caller is accepted by phonebook and dialog will be shown."); - if (caller.Show) - { - Log.Info("Caller is accepted by phonebook and dialog will be shown."); - - DialogOnIncomingCall(caller.Name, msn); - } - else - { - Log.Info("Caller is denied by phonebook and dialog won't be shown."); - } + DialogOnIncomingCall(caller.Name, msn); } - i++; + else + { + Log.Info("Caller is denied by phonebook and dialog won't be shown."); + } } - while (!foundCaller && (i < phonebook.Count)); + i++; + } + while (!foundCaller && (i < phonebook.Count)); - if (!foundCaller) + if (!foundCaller) + { + Log.Info("Caller is not identified by phonebook."); + + if (FritzBox._saveUnknownCaller) { - Log.Info("Caller is not identified by phonebook."); + Log.Info("saveUnknownCallers is ON - Caller is added to the phonebook."); - if (FritzBox._saveUnknownCaller) - { - Log.Info("saveUnknownCallers is ON - Caller is added to the phonebook."); + Caller caller = new Caller(callerId, callerId, FritzBox._showUnknownCaller); + phonebook.Add(caller); + } - Caller caller = new Caller(callerId, callerId, FritzBox._showUnknownCaller); - phonebook.Add(caller); - } + if (FritzBox._showUnknownCaller) + { + Log.Info("showUnknownCallers is ON - Caller is shown."); - if (FritzBox._showUnknownCaller) - { - Log.Info("showUnknownCallers is ON - Caller is shown."); - - DialogOnIncomingCall(callerId, msn); - } + DialogOnIncomingCall(callerId, msn); } + } - } } - else - DialogOnIncomingCall(callerId, msn); } + else + DialogOnIncomingCall(callerId, msn); } } @@ -492,6 +494,7 @@ Log.Info(" DateTime: {0}", dateTime); Log.Info(" conneted time (in s): {0}", connectedTime.ToString()); } + #endregion void DialogOnIncomingCall(string strCallerId, string strMSN) @@ -580,7 +583,6 @@ } } - public void OnStartExternal(Process proc, bool waitForExit) { if (waitForExit) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |