Processing/initiating OpenGPG/custom stanzas

12 views
Skip to first unread message

hughbarnard

unread,
Mar 8, 2010, 3:17:57 AM3/8/10
to perl-net-jabber-bot
Hi folks

First of all, thanks to all for this. I'm new to IM and Jabber but had
this (or at least an 'idiot' bot) working in about 2 hours. I have an
end to end going and my bot does some primitive processing.

However, I do want to initiate (probably from the 'bot' end, I don't
want any non-encryoted) GPG encrypted Jabber. Looking at the specs:
http://xmpp.org/extensions/xep-0027.html
I apparently have to do something like this in the presence stanza,

<presence from='pgmi...@jabber.org/wj_dev2' to='j...@jabber.org'>
<status>Online</status>
<x xmlns='jabber:x:signed'>
iQA/AwUBOjU5dnol3d88qZ77EQI2JACfRngLJ045brNnaCX78ykKNUZaTIoAoPHI
2uJxPMGR73EBIvEpcv0LRSy+
=45f8
</x>
</presence>

I'm a Perl person so I'm happy to hack a little to arrive at the GPG.
I think the larger thrust of my question is just constructing/sending/
processing 'tailor made' Jabber stanzas within the bot framework. But
I'm new to IM etc., so that may be wide of the mark?

Best regards Hugh Barnard

Todd Rinaldo

unread,
Mar 15, 2010, 12:06:26 AM3/15/10
to perl-net-...@googlegroups.com

Sorry for the slow reply.

The presence message you would have to send would ultimately be
through a Net::Jabber call. During initialization, calls
PresenceSend() with no options. Later you can call PresenceSend as
much as you want with more options, which is probably how you'd make
what you want to happen. You'll of course have to go to the trouble of
encrypting/decrypting each message in your own code, probably with
some other perl module to help you.

To send a presence message, assuming your bot is called $bot, you could call:

$bot->ChangeStatus
Which is really just a loose wrapper around:
$bot->jabber_client->PresenceSend

Jabber client's PresenceSend function is defined and documented at the
below link.
http://search.cpan.org/~reatmon/Net-XMPP-1.0/lib/Net/XMPP/Protocol.pm

My schedule doesn't really allow me to do much developing on this
right now, but I always welcome patches via github or just shoot some
code to this list and we'll see what we can do. The idea of natively
supporting encryption in the bot is an interesting idea, although It
might be more appropriatley implemented at a lower level in
Net::Jabber or Net::XMPP. We can sort that out if you get it working.

Regardless, let us know how you progress on this. It sounds interesting!

Todd

hughbarnard

unread,
Mar 15, 2010, 10:36:03 AM3/15/10
to perl-net-jabber-bot
Hi Todd

Thanks for this, don't worry about speed of reply, everyone has lives
to lead too..some comments below...

On 15 Mar, 04:06, Todd Rinaldo <to...@null.net> wrote:
> On Mon, Mar 8, 2010 at 3:17 AM, hughbarnard <hugh.barn...@googlemail.com> wrote:
> > Hi folks


> > However, I do want to initiate (probably from the 'bot' end, I don't
> > want any non-encryoted) GPG encrypted Jabber. Looking at the specs:
> >http://xmpp.org/extensions/xep-0027.html
> > I apparently have to do something like this in the presence stanza,
>

> > <presence from='pgmill...@jabber.org/wj_dev2' to='...@jabber.org'>


> >  <status>Online</status>
> >  <x xmlns='jabber:x:signed'>
> >    iQA/AwUBOjU5dnol3d88qZ77EQI2JACfRngLJ045brNnaCX78ykKNUZaTIoAoPHI
> >    2uJxPMGR73EBIvEpcv0LRSy+
> >    =45f8
> >  </x>
> > </presence>
>

> The presence message you would have to send would ultimately be
> through a Net::Jabber call. During initialization, calls
> PresenceSend() with no options. Later you can call PresenceSend as
> much as you want with more options, which is probably how you'd make
> what you want to happen. You'll of course have to go to the trouble of
> encrypting/decrypting each message in your own code, probably with
> some other perl module to help you.

--> Yes that's Gpg.pm, I have that going for the email bit of the
project,,
actually I can send GPG messages to the bot already and it decrypts
but I cut and paste into the chat window
to encrypt...my objective is is for it 'just to work'...

> To send a presence message, assuming your bot is called $bot, you could call:
>
> $bot->ChangeStatus
> Which is really just a loose wrapper around:
> $bot->jabber_client->PresenceSend
>
> Jabber client's PresenceSend function is defined and documented at the
> below link.http://search.cpan.org/~reatmon/Net-XMPP-1.0/lib/Net/XMPP/Protocol.pm

-> Thanks that's really helpful, the modules are a bit of a jungle and
one needs the map...
I'll take a look and give this a spin..I'm using Gajim (apart from
Google Chat + FireGPG) and I have
the GPG keys loaded...


> My schedule doesn't really allow me to do much developing on this
> right now, but I always welcome patches via github or just shoot some
> code to this list and we'll see what we can do. The idea of natively
> supporting encryption in the bot is an interesting idea, although It
> might be more appropriatley implemented at a lower level in
> Net::Jabber or Net::XMPP. We can sort that out if you get it working.
>
> Regardless, let us know how you progress on this. It sounds interesting!

-> No problem, I hope already some of the commentary above on the tool
set is useful for
others...yes, same problem, time!, so I'll probably post something
informal rather than a
carefully crafted patch..thanks again Hugh


> Todd

Reply all
Reply to author
Forward
0 new messages