You are here: MessengerYouLike.IMSDK > IMSDK Reference > IMSDK Namespace > Classes > IMClient Class > IMClient Events > IMClient.OnFriendAuthorized Event
MessengerYouLike
IMClient.OnFriendAuthorized Event

When IMSDK.IMClient.BeginAddFriend request is accepted by the IMClient

C#
public event OnFriendAuthorized;
Visual Basic
Public Event OnFriendAuthorized(ByVal FriendUsername As String, ByVal online As Boolean)
Return Values 
Description 
ByVal FriendUsername As String 
Username of Friend 
ByVal Online As Boolean 
user is Online or Offline 

When a sub IMSDK.IMClient.BeginAddFriend is called then on friend side a event IMSDK.IMClient.OnFriendAskingPrimssion is raised if the friend accepts the request by calling the sub IMSDK.IMClient.BeginFriendAuthorizationAccepted then this event is fired if the user is online when he is being added then the online parameter is true else false

[Visual Basic]
 
'Create a new IMClient
Dim MC as new IMSDK.IMClient
 
 
 
'Call the Listen Sub
MC.Listen()
 
 
 
'Now Try to login
MC.BeginLogin(TxtUsername.Text,TxtPassword.Text)
 
 
 
'if username and password is valid then
Private Sub MC_OnLoggedin(ByVal UserObject As IMSDK.User) Handles MC.OnLoggedin
    Debug.WriteLine("Username logged in : " & MCUser.Username & " , " & MCUser.Password)
End Sub
 
 
 
'if username or password is invalid then
Private Sub MC_OnUsernameOrPasswordInvalid(ByVal Username As String, ByVal Password As String) Handles MC.OnUsernameOrPasswordInvalid
  Debug.WriteLine("Username password invalid : " & Username & " , " & Password)
End Sub
 
 
 
 
'Now Add a Friend
 MC.BeginAddFriend(TxtFriendusername.text, TxtGroupUID.Text, txtMessage.text)
 
 
 
 
'If Friend Invitation Accepted then
    Private Sub IMC_OnFriendAuthorized(ByVal FriendUsername As String, ByVal online As Boolean) Handles IMC.OnFriendAuthorized
        Debug.WriteLine("user : " & FriendUsername & " has authorized you and is online :" & online.ToString)
     End Sub
 
 
 
 
'If Friend Invitation Denied then
Private Sub MC_OnFriendAuthorizationDeniedMessage(ByVal FriendUsername As String, ByVal message As String) Handles MC.OnFriendAuthorizationDeniedMessage
      Debug.WriteLine("Username : " & FriendUsername & " has denied your invitaion with a message : " & message)
 End Sub
Copyright (c) 2007. All rights reserved.