Pawan
Pawan

Reputation: 1744

Check whether a user is logged in to Skype or not

I am working with the Skype API. When my application starts I check to see whether Skype is actually running.

foreach (Process p in System.Diagnostics.Process.GetProcessesByName("skype"))
{
    return true;
}

Now I want to check whether a user has logged in to Skype or not. How can I check this?

Upvotes: 2

Views: 2270

Answers (1)

LightStriker
LightStriker

Reputation: 21004

Downloaded the Skype API to check... Because curiosity. Actually surprised how much stuff is exposed.

Skype skype = new Skype();
// Return true if Skype is running.
if (!skype.Client.IsRunning) 
    return;

// User is not logged in.
if (skype.CurrentUserStatus == TUserStatus.cusLoggedOut)
    return;

// Friends
foreach(User user in skype.Friends) 
{
    if (user.OnlineStatus == TOnlineStatus.olsOnline)
    { /*Insert what you want...*/ }

} 

Note that Skype first ask you if you want to let a specific plugin access it.

Upvotes: 4

Related Questions