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

Proposed by bmuskalla
Status: Needs review
Proposed branch: lp:~b-muskalla/do-plugins/do-plugins
Merge into: lp:do-plugins
Diff against target: 50 lines (+7/-26)
1 file modified
Skype/src/Skype.cs (+7/-26)
To merge this branch: bzr merge lp:~b-muskalla/do-plugins/do-plugins
Reviewer Review Type Date Requested Status
Do Plugins Team Pending
Review via email: mp+146276@code.launchpad.net

Description of the change

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.

To post a comment you must log in.

Unmerged revisions

754. By bmuskalla

Fix to find Skype contacts

Instead of querying all groups, simply issue a query on all available
friends as groups can be empty or cannot be returned in newer Skype
versions.

Related bug: 781553

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Skype/src/Skype.cs'
2--- Skype/src/Skype.cs 2011-08-06 11:38:07 +0000
3+++ Skype/src/Skype.cs 2013-02-02 17:37:21 +0000
4@@ -177,7 +177,7 @@
5 {
6 request = string.Format (request, args);
7 string reply = SkypeObject.Invoke (string.Format ("GET {0}", request));
8- if (!reply.StartsWith ("ERROR"))
9+ if (!reply.StartsWith ("ERROR") && reply.Length != 0)
10 return reply.Substring (request.Length).Trim ();
11 Log<Skype>.Warn ("Skype failed for {0}", request);
12 Log<Skype>.Debug ("Skype replied with: {0}", reply);
13@@ -203,31 +203,12 @@
14 yield break;
15 }
16
17- IEnumerable<string> groups = SkypeObject.Invoke ("SEARCH GROUPS ALL") .Substring (7).Split (new [] {','});
18-
19- string onlineGroup = groups.FirstOrDefault (g =>
20- SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim ())).Contains ("SKYPE_FRIENDS"));
21-
22- if (string.IsNullOrEmpty (onlineGroup)) {
23- Log<Skype>.Error ("Could not find online group.");
24- groups.ForEach (g => {
25- Log<Skype>.Debug (SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim())));
26- } );
27- yield break;
28- }
29-
30- string handlesReply = Skype.Get ("GROUP {0} USERS", onlineGroup);
31-
32- if (handlesReply.StartsWith ("ERROR")) {
33- Log<Skype>.Error ("Could not fetch friend handles.");
34- Log<Skype>.Debug ("Skype returned: {0}", handlesReply);
35- }
36-
37- IEnumerable<string> handles = handlesReply.Split (new [] {','});
38-
39- foreach (string handle in handles)
40- yield return handle.Trim ();
41-
42+ IEnumerable<string> handles = SkypeObject.Invoke ("SEARCH FRIENDS").Split (new [] {','});
43+
44+ foreach (string handle in handles) {
45+ if(handle.Trim ().Length != 0)
46+ yield return handle.Trim ();
47+ }
48 yield break;
49 }
50 }

Subscribers

People subscribed via source and target branches