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
=== 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 @@
177 {177 {
178 request = string.Format (request, args);178 request = string.Format (request, args);
179 string reply = SkypeObject.Invoke (string.Format ("GET {0}", request));179 string reply = SkypeObject.Invoke (string.Format ("GET {0}", request));
180 if (!reply.StartsWith ("ERROR"))180 if (!reply.StartsWith ("ERROR") && reply.Length != 0)
181 return reply.Substring (request.Length).Trim ();181 return reply.Substring (request.Length).Trim ();
182 Log<Skype>.Warn ("Skype failed for {0}", request);182 Log<Skype>.Warn ("Skype failed for {0}", request);
183 Log<Skype>.Debug ("Skype replied with: {0}", reply);183 Log<Skype>.Debug ("Skype replied with: {0}", reply);
@@ -203,31 +203,12 @@
203 yield break;203 yield break;
204 }204 }
205 205
206 IEnumerable<string> groups = SkypeObject.Invoke ("SEARCH GROUPS ALL") .Substring (7).Split (new [] {','});206 IEnumerable<string> handles = SkypeObject.Invoke ("SEARCH FRIENDS").Split (new [] {','});
207207
208 string onlineGroup = groups.FirstOrDefault (g => 208 foreach (string handle in handles) {
209 SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim ())).Contains ("SKYPE_FRIENDS"));209 if(handle.Trim ().Length != 0)
210 210 yield return handle.Trim ();
211 if (string.IsNullOrEmpty (onlineGroup)) {211 }
212 Log<Skype>.Error ("Could not find online group.");
213 groups.ForEach (g => {
214 Log<Skype>.Debug (SkypeObject.Invoke (string.Format ("GET GROUP {0} TYPE", g.Trim())));
215 } );
216 yield break;
217 }
218
219 string handlesReply = Skype.Get ("GROUP {0} USERS", onlineGroup);
220
221 if (handlesReply.StartsWith ("ERROR")) {
222 Log<Skype>.Error ("Could not fetch friend handles.");
223 Log<Skype>.Debug ("Skype returned: {0}", handlesReply);
224 }
225
226 IEnumerable<string> handles = handlesReply.Split (new [] {','});
227
228 foreach (string handle in handles)
229 yield return handle.Trim ();
230
231 yield break;212 yield break;
232 }213 }
233 }214 }

Subscribers

People subscribed via source and target branches