header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

Google Talk (gtalk)
Last Post 12 Jan 2008 12:59 AM by Jaykul. 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 06:38 PM  

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

marco.shawUser is Offline
Site Moderator
Advanced Member
Advanced Member
Posts:653
Avatar

--
04 Jan 2008 03:46 AM  
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%...
Marco

*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*Blog - http://marcoshaw.blogspot.com
calvinUser is Offline
New Member
New Member
Posts:5
Avatar

--
04 Jan 2008 04:05 AM  

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:527
Avatar

--
04 Jan 2008 01:28 PM  
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:527
Avatar

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

--
04 Jan 2008 03:24 PM  

Thanks halr9000.

As noted in my previous posting, I have looked at that page, as well as http://forum.ag-software.de/forum.php?req=thread&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:527
Avatar

--
04 Jan 2008 03:37 PM  
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 03:45 PM  

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:527
Avatar

--
07 Jan 2008 03:45 PM  

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:527
Avatar

--
07 Jan 2008 08:43 PM  
Try this: http://powershellcentral.com/scripts/103
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast
Author, TechProsaic
calvinUser is Offline
New Member
New Member
Posts:5
Avatar

--
07 Jan 2008 09:33 PM  

Thank you very much. Works like a charm!

JaykulUser is Online
New Member
New Member
Posts:94
Avatar

--
12 Jan 2008 12:59 AM  

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.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer