Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Web Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Search the Internet Archive with the Wayback MachineIE8 doesn't like me, it wants me to guess what to click. »
    comments

    I decided that I wanted to provide a "live chat" link on my website so I had a look around for what software I could use to do it. There were quite a few good options, but none that were good enough for me and free. So, I had a look into using my MSN account which turned out to be quite easy.

    First off, you will need to sign in and go to:

    http://settings.messenger.live.com/applications/WebSettings.aspx

    Then, check the box that says "Allow anyone on the web to see my presence and send me messages.":

    Then, go to the "Create HTML" link on the left hand side of the page and choose "Status icon" from the "Choose which control you want to display on your page" section:

    You will then be shown a small snippet of HTML that you can use to enter onto your webpage:

    What we need to do is to use the URL from the "src" attribute in the above link, and in my case it looked like:

    http://messenger.services.live.com/users/338469ac4a1e779a@apps.messenger.live.com/presenceimage?mkt=en-GB

    I only ever wanted to show whether I was online or not (I wasn't bothered about the other status' such as busy, away, in a call etc) so I thought an easy way of getting my status was to use the image returned in the above URL and see whether it was the grey looking icon (which meant I was offline) or one of the other green type ones that meant I was online.

    To do this, I added a few imports:

    1. Imports System.Net
    2. Imports System.IO
    3. Imports System.Drawing

    Then, I made a fairly simple function to grab the image and check how many colours were in the image (it's a greyscale image that is shown if you're offline, so a low amount means that is your status):

    1. Public Function IsOnline() As Boolean
    2.         Dim strURL As String
    3.         Dim wbrq As HttpWebRequest
    4.         Dim wbrs As HttpWebResponse
    5.  
    6.         ' Set the URL (and add any querystring values)  
    7.         strURL = "http://messenger.services.live.com/users/b2bec1cffdfed491@apps.messenger.live.com/presenceimage?mkt=en-GB"
    8.  
    9.         ' Create the web request  
    10.         wbrq = WebRequest.Create(strURL)
    11.         wbrq.Method = "GET"
    12.  
    13.         ' Read the returned bitmap object and return the status  
    14.         wbrs = wbrq.GetResponse
    15.         Dim b As New Bitmap(wbrs.GetResponseStream)
    16.         If b.Palette.Entries.GetLength(0) > 64 Then
    17.             Return True
    18.         Else
    19.             Return False
    20.         End If
    21.     End Function

    So, as you can see from above, if the number of entries is less than 64, this dictates that I'm offline. Anything else, and I'm one of the other status' which as far as I'm concerned in this case makes me online and available.

    To see it in action, have a look at the "Live Chat" link in the footer of my website.

    About the Author

    User bio imageMark is primarily an ASP.NET developer and also has skills in SQL Server, HTML and CSS. He is based in the North East of England and has a 2 year old son named George. Mark is the founder of http://aspnetlibrary.com, has a blog at http://weblogs.asp.net/marksmith and is the director of http://mdssolutions.co.uk.
    Social SitingsTwitterHomePageLTD RSS Feed
    3919 views
    Instapaper

    3 comments

    Comment from: Erik [Visitor] · http://antecknat.se
    Erik Thank you for a relevant post about this! Trying to google this solutions ends up with tons of hits with crap.
    11/05/09 @ 03:14
    Comment from: ca8msm [Member] Email
    ca8msm Your welcome Erik, hope it helped you.
    11/05/09 @ 03:34
    Comment from: Martin [Visitor]
    Martin Could you write it for C# or PHP? Thank you soooo much!!
    07/29/11 @ 18:11

    Leave a comment


    Your email address will not be revealed on this site.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)