header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Google Talk (gtalk)
Last Post 11 Jan 2008 03:59 PM by Joel "Jaykul" Bennett. 11 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
calvinUser is Offline
New Member
New Member
Posts:5
Avatar

--
03 Jan 2008 09:38 AM

    Does anyone have a script that can send an IM to GTalk, one that doesn't use NetCmdlets? Thanks

    Marco ShawUser is Offline
    Veteran Member
    Veteran Member
    Posts:1684
    Avatar

    --
    03 Jan 2008 06:46 PM
    I think if you can find an open-source Jabber/XMPP .NET library, then you're set. I couldn't seem to find anything recent enough that seemed to be supported or didn't need you to run through multiple steps to get the source, and then you have to compile it yourself.

    You migth also be able to use COM, but PowerShell's COM support isn't 100%...
    calvinUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    03 Jan 2008 07:05 PM

    Thanks Marco.

    I did find one called agsXMPP and tried this function that's intended Jabber. But even after looking over this I haven't been able to get it to work with Gtalk just yet.

    halr9000User is Offline
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    04 Jan 2008 04:28 AM
    I'll work on this. Gtalk has some peculiarities in how they do the login session which possibly the AGSXMPP lib doesn't support. Should be possible though. Gimme a day or three.
    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast
    Author, TechProsaic
    halr9000User is Offline
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    04 Jan 2008 04:29 AM
    Until I get a chance later today to dive in, maybe this'll help: http://www.ag-software.de/index.php...oogle-talk
    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast
    Author, TechProsaic
    calvinUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    04 Jan 2008 06:24 AM

    Thanks halr9000.

    As noted in my previous posting, I have looked at that page, as well as http://forum.ag-software.de/forum.p...mp;id=487. No luck yet (though haven't really spent that much time on it yet).

    halr9000User is Offline
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    04 Jan 2008 06:37 AM
    I didn't notice the second link you inserted. I think we'll be changing the stylesheet on the website such that links are more visible...
    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast
    Author, TechProsaic
    calvinUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    04 Jan 2008 06:45 AM

    Great idea! I wouldn't have noticed if I didn't insert it myself.

    halr9000User is Offline
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    07 Jan 2008 06:45 AM

    This is very close to working, but I think some tweaking needs to be done to the way I'm calling the Send() method.  I've run out of time for now to work on it, but maybe someone else can pick it up.  The line from the SDK examples I'm having trouble translating from C# is this:

    xmpp.OnLogin += delegate(object o) { xmpp.Send(new Message(new Jid(JID_RECEIVER), MessageType.chat, "Hello, how are you?";)); };

    As you can see below, I did not use the same constructor as they did but it is valid.  I don't know what to do with the delegate bits and I'm wondering if there needs to be a while loop to look for xmpp.OnLogin or some  property that says we're connected.

    function Send-XmppMessage {
        param (
            $From,
            $Password,
            $To,
            $Body
        )
       
        # This function reads a string from the host while masking with *'s.
        function Read-HostMasked( [string]$prompt="Password" ) {
            $password = Read-Host -AsSecureString $prompt;
            $BSTR = [System.Runtime.InteropServices.marshal]::SecureStringToBSTR($password);
            $password = [System.Runtime.InteropServices.marshal]::PtrToStringAuto($BSTR);
            [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR);
            return $password;
        }
       
        [void][reflection.assembly]::LoadFrom( $(resolve-path $profiledir\Assemblies\agsXMPP.dll) )
        $jidSender = New-Object agsxmpp.jid( $From )
        $jidReceiver = New-Object agsxmpp.jid ( $To )
        $xmppClient = New-Object agsxmpp.XmppClientConnection( $jidSender.Server )
        $Message = New-Object agsXMPP.protocol.client.Message( $jidReceiver, $Body )
        if ( !$password ) { $password = Read-HostMasked }
        $xmppClient.Open( $jidSender.User, $Password )
        $xmppClient.Send( $Message )
        $xmppClient.Close()
    }

    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast
    Author, TechProsaic
    halr9000User is Offline
    PowerShell MVP, Site Admin
    Advanced Member
    Advanced Member
    Posts:565
    Avatar

    --
    07 Jan 2008 11:43 AM
    Community Director, PowerShellCommunity.org
    Co-host, PowerScripting Podcast
    Author, TechProsaic
    calvinUser is Offline
    New Member
    New Member
    Posts:5
    Avatar

    --
    07 Jan 2008 12:33 PM

    Thank you very much. Works like a charm!

    Joel "Jaykul" BennettUser is Offline
    Basic Member
    Basic Member
    Posts:112
    Avatar

    --
    11 Jan 2008 03:59 PM

    in response to all the user demand (yeah, all two of you) ...

    http://www.codeplex.com/PoshXmpp/

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer