Skype status web service

Skype provides some http requests to display your online status as an image or text but there's no web service that provides the information. That's too bad, but here is the code required (simplest webservice ever).

<%@ WebService Language="C#" Class="Klinkby.Skyper" %> using System; using System.IO; using System.Net; using System.Web.Services; namespace Klinkby { public enum Status { Unknown, Offline = 1, Online = 2, Away = 3, NotAvailable = 4, DoNotDisturb = 5, SkypeMe = 7, } [WebService(Namespace = "http://kli.dk")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Skyper : System.Web.Services.WebService { [WebMethod(Description="Gets the current online status of a Skype user")] public Status GetStatus(string userName) { string statusUrl = String.Format("http://mystatus.skype.com/{0}.num", userName); WebRequest request = (WebRequest)WebRequest.Create(statusUrl); WebResponse response = (WebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); int statusId = stream.ReadByte() - (int)'0'; stream.Dispose(); Status status = (Status)statusId; return status; } } }

Google
m@kli.dk @klinkby RSS feed  GitHub