Update-own-VCard-details - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Update own VCard details
VB code
Dim WithEvents wodXMPP1 As wodXMPPCom
Private Sub Form_Load()
    Set wodXMPP1 = New wodXMPPCom
    
    wodXMPP1.Login = "JID__username@domain.com"
    wodXMPP1.Password = "JID__password"
    'Connect to Jabber/XMPP server.
    wodXMPP1.Connect
End Sub

'Connected Event fires when wodXMPP connects to remote server.
Private Sub wodXMPP1_Connected()
    'When Connected Event is fired, we can update our VCard details.
    'In this example we will do that using button on our form (check Command1_Click).
    MsgBox "Connected"
End Sub

'Disconnected Event fires when wodXMPP disconnects from server.
Private Sub wodXMPP1_Disconnected(ByVal ErrorCode As Long, ByVal ErrorText As String)
    'Inside Disconnected Event we can check for an error using ErrorText and ErrorCode variable.
    If ErrorCode <> 0 Then
        MsgBox "Error: " & ErrorText
    End If
End Sub

Private Sub Command1_Click()
    'Add VCard details we want to update.
    wodXMPP1.VCard.NickName = "nickname"
    wodXMPP1.VCard.FirstName = "first name"
    wodXMPP1.VCard.LastName = "last name"
    wodXMPP1.VCard.Email = "email address"
    wodXMPP1.VCard.URL = "homepage URL"
    wodXMPP1.VCard.Description = "own description"
    
    'Send new VCard details to server.
    'After VCard details is updated. We can receive new details using Receive Method.
    'Please check Command2_Click and VCardDetails Event.
    wodXMPP1.VCard.Send
End Sub

Private Sub Command2_Click()
    'Receive own VCard details from server.
    wodXMPP1.VCard.Receive
End Sub

'VCardDetails Event fires when someone's VCard arrives from the server.
Private Sub wodXMPP1_VCardDetails(ByVal Contact As WODXMPPCOMLib.IXMPPContact, ByVal Partial As Boolean)
    'Display own VCard details.
    Debug.Print "NickName: " & wodXMPP1.VCard.NickName
    Debug.Print "FirstName: " & wodXMPP1.VCard.FirstName
    Debug.Print "LastName: " & wodXMPP1.VCard.LastName
    Debug.Print "Email: " & wodXMPP1.VCard.Email
    Debug.Print "URL: " & wodXMPP1.VCard.URL
    Debug.Print "Description: " & wodXMPP1.VCard.Description
End Sub
VB.NET code
Dim WithEvents wodXMPP1 As WODXMPPCOMLib.wodXMPPCom
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    wodXMPP1 = New WODXMPPCOMLib.wodXMPPCom

    wodXMPP1.Login = "JID__username@domain.com"
    wodXMPP1.Password = "JID__password"
    'Connect to Jabber/XMPP server.
    wodXMPP1.Connect()
End Sub

'Connected Event fires when wodXMPP connects to remote server.
Private Sub wodXMPP1_Connected() Handles wodXMPP1.Connected
    'When Connected Event is fired, we can update our VCard details.
    'In this example we will do that using button on our form (check Command1_Click).
    MsgBox("Connected")
End Sub

'Disconnected Event fires when wodXMPP disconnects from server.
Private Sub wodXMPP1_Disconnected(ByVal ErrorCode As Integer, ByVal ErrorText As String) Handles wodXMPP1.Disconnected
    'Inside Disconnected Event we can check for an error using ErrorText and ErrorCode variable.
    If ErrorCode <> 0 Then
        MsgBox("Error: " & ErrorText)
    End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'Add VCard details we want to update.
    wodXMPP1.VCard.NickName = "nickname"
    wodXMPP1.VCard.FirstName = "first name"
    wodXMPP1.VCard.LastName = "last name"
    wodXMPP1.VCard.Email = "email address"
    wodXMPP1.VCard.URL = "homepage URL"
    wodXMPP1.VCard.Description = "description"

    'Send new VCard details to server.
    'After VCard details is updated. We can receive new details using Receive Method.
    'Please check Command2_Click and VCardDetails Event.
    wodXMPP1.VCard.Send()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    'Receive own VCard details from server.
    wodXMPP1.VCard.Receive()
End Sub

'VCardDetails Event fires when someone's VCard arrives from the server.
Private Sub wodXMPP1_VCardDetails(ByVal Contact As WODXMPPCOMLib.XMPPContact, ByVal [Partial] As Boolean) Handles wodXMPP1.VCardDetails
    'Display own VCard details.
    Console.WriteLine("NickName: " & wodXMPP1.VCard.NickName)
    Console.WriteLine("FirstName: " & wodXMPP1.VCard.FirstName)
    Console.WriteLine("LastName: " & wodXMPP1.VCard.LastName)
    Console.WriteLine("Email: " & wodXMPP1.VCard.Email)
    Console.WriteLine("URL: " & wodXMPP1.VCard.URL)
    Console.WriteLine("Description: " & wodXMPP1.VCard.Description)
End Sub
C# code
WODXMPPCOMLib.wodXMPPCom wodXMPP1;
private void Form1_Load(System.Object sender, System.EventArgs e)
{
    wodXMPP1 = new WODXMPPCOMLib.wodXMPPCom();
    wodXMPP1.Connected += new WODXMPPCOMLib._IwodXMPPComEvents_ConnectedEventHandler(wodXMPP1_Connected);
    wodXMPP1.Disconnected += new WODXMPPCOMLib._IwodXMPPComEvents_DisconnectedEventHandler(wodXMPP1_Disconnected);
    wodXMPP1.VCardDetails += new WODXMPPCOMLib._IwodXMPPComEvents_VCardDetailsEventHandler(wodXMPP1_VCardDetails);

    wodXMPP1.Login = "JID__username@domain.com";
    wodXMPP1.Password = "JID__password";
    //Connect to Jabber/XMPP server.
    wodXMPP1.Connect(null);
}

//Connected Event fires when wodXMPP connects to remote server.
private void wodXMPP1_Connected()
{
    //When Connected Event is fired, we can update our VCard details.
    //In this example we will do that using button on our form (check Command1_Click).
    MessageBox.Show("Connected");
}


//Disconnected Event fires when wodXMPP disconnects from server.
private void wodXMPP1_Disconnected(int ErrorCode, string ErrorText)
{
    //Inside Disconnected Event we can check for an error using ErrorText and ErrorCode variable.
    if (ErrorCode != 0)
    {
        MessageBox.Show("Error: " + ErrorText);
    }
}

private void button1_Click(object sender, EventArgs e)
{
    //Add VCard details we want to update.
    wodXMPP1.VCard.NickName = "nickname";
    wodXMPP1.VCard.FirstName = "first name";
    wodXMPP1.VCard.LastName = "last name";
    wodXMPP1.VCard.Email = "email address";
    wodXMPP1.VCard.URL = "homepage URL";
    wodXMPP1.VCard.Description = "description";

    //Send new VCard details to server.
    //After VCard details is updated. We can receive new details using Receive Method.
    //Please check Command2_Click and VCardDetails Event.
    wodXMPP1.VCard.Send();
}

private void button2_Click(object sender, EventArgs e)
{
    //Receive own VCard details from server.
    wodXMPP1.VCard.Receive();
}

//VCardDetails Event fires when someone's VCard arrives from the server.
void wodXMPP1_VCardDetails(WODXMPPCOMLib.XMPPContact Contact, bool Partial)
{
    //Display own VCard details.
    Console.WriteLine("NickName: " + wodXMPP1.VCard.NickName);
    Console.WriteLine("FirstName: " + wodXMPP1.VCard.FirstName);
    Console.WriteLine("LastName: " + wodXMPP1.VCard.LastName);
    Console.WriteLine("Email: " + wodXMPP1.VCard.Email);
    Console.WriteLine("URL: " + wodXMPP1.VCard.URL);
    Console.WriteLine("Description: " + wodXMPP1.VCard.Description);
}