← Back to team overview

do-plugins team mailing list archive

[Merge] lp:~b-muskalla/do-plugins/do-plugins into lp:do-plugins

 

bmuskalla has proposed merging lp:~b-muskalla/do-plugins/do-plugins into lp:do-plugins.

Requested reviews:
  Do Plugins Team (do-plugins)
Related bugs:
  Bug #781553 in Do Plugins: "Skype plugin no longer searches over contacts"
  https://bugs.launchpad.net/do-plugins/+bug/781553

For more details, see:
https://code.launchpad.net/~b-muskalla/do-plugins/do-plugins/+merge/146276

Adresses problem using the Skype plugin not finding it's contact infos. Besides that groups can be empty, the group DBus command doesn't seem to properly return user handles in current Skype versions. Querying over friends leads to the same results.
-- 
https://code.launchpad.net/~b-muskalla/do-plugins/do-plugins/+merge/146276
Your team Do Plugins Team is requested to review the proposed merge of lp:~b-muskalla/do-plugins/do-plugins into lp:do-plugins.
=== modified file 'Skype/src/Skype.cs'
--- Skype/src/Skype.cs	2011-08-06 11:38:07 +0000
+++ Skype/src/Skype.cs	2013-02-02 17:37:21 +0000
@@ -177,7 +177,7 @@
 		{
 			request = string.Format (request, args);
 			string reply = SkypeObject.Invoke (string.Format ("GET {0}", request));
-			if (!reply.StartsWith ("ERROR"))
+			if (!reply.StartsWith ("ERROR") && reply.Length != 0)
 				return reply.Substring (request.Length).Trim ();
 			Log<Skype>.Warn ("Skype failed for {0}", request);
 			Log<Skype>.Debug ("Skype replied with: {0}", reply);
@@ -203,31 +203,12 @@
 						yield break;
 				}
 				
-				IEnumerable<string> groups = SkypeObject.Invoke ("SEARCH GROUPS ALL") .Substring (7).Split (new [] {','});
-
-				string onlineGroup = groups.FirstOrDefault (g => 
-				    SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim ())).Contains ("SKYPE_FRIENDS"));
-				
-				if (string.IsNullOrEmpty (onlineGroup)) {
-					Log<Skype>.Error ("Could not find online group.");
-					groups.ForEach (g => {
-						Log<Skype>.Debug (SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim())));
-					} );
-					yield break;
-				}
-				
-				string handlesReply = Skype.Get ("GROUP {0} USERS", onlineGroup);
-
-				if (handlesReply.StartsWith ("ERROR")) {
-					Log<Skype>.Error ("Could not fetch friend handles.");
-					Log<Skype>.Debug ("Skype returned: {0}", handlesReply);
-				}
-				
-				IEnumerable<string> handles = handlesReply.Split (new [] {','});
-
-				foreach (string handle in handles)
-					yield return handle.Trim ();
-                                  
+				IEnumerable<string> handles = SkypeObject.Invoke ("SEARCH FRIENDS").Split (new [] {','});
+
+				foreach (string handle in handles) {
+					if(handle.Trim ().Length != 0)
+						yield return handle.Trim ();
+				}              
 				yield break;
 			}
 		}