Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Experiences with IM support?

by andreychek (Parson)
on Apr 17, 2002 at 14:49 UTC ( #159832=note: print w/ replies, xml ) Need Help??


in reply to Experiences with IM support?

As others have said, Jabber may be a good way to go. What you could do is have your daemon connected to a Jabber server as a client, just like any other client connects to a Jabber server. Connecting to a Jabber server is the same for a non-interactive application like your daemon as it would be for an interactive chat session.

At that point, whenever your daemon wishes to send a message to someone, just have it do a lookup to see if that particular person is online, and what their status is. In Jabber terms, you're checking for that person's "presence". Included with the Net::Jabber module is one called Net::Jabber::Presence which you can use to detect a person's online status. This allows you to not only know if they are online, but you can detect whether they have their client set to something like "Do not Disturb" or "Extended Away". Perhaps, in one or both of those cases, you may wish to send an email versus giving them an IM.

There are already some Jabber clients written in Perl. A few examples are:

http://www.jabbercentral.org/clients/view.php?id=1007327470 - Perl Jabber Bot
http://www.jabbercentral.org/clients/view.php?id=962065957 - Jarl, Perl Jabber Client
http://www.jabbercentral.org/clients/view.php?id=1015797608 - pJab, Perl Console Client

Good luck!
-Eric


Comment on Re: Experiences with IM support?
Re: Re: Experiences with IM support?
by Mur (Pilgrim) on Apr 17, 2002 at 18:33 UTC
    Not to sound too fussy here, but my experience so far with Net::Jabber is less than great. A simple script using it produces several errors stemming from careless code in XML::Stream::Parser:
    "my" variable $file masks earlier declaration in same scope at /usr/lo +cal/lib/perl5/site_perl/5.6.1/XML/Stream/Parser.pm line 298. Use of uninitialized value in string ne at /usr/local/lib/perl5/site_p +erl/5.6.1/XML/Stream/Parser.pm line 134. Use of uninitialized value in split at /usr/local/lib/perl5/site_perl/ +5.6.1/Net/Jabber.pm line 759.
    Is this package supported? If so, why are errors like the first one still present? (It results from this code:
    sub parsefile { my $self = shift; my $file = shift; open(FILE,$file); my $file; while(<FILE>) { $file .= $_; } ...
    Note the two appearances of "my $file".

    Edit by tye to replace PRE tags with CODE tags

      Well, I can't comment on the specific problems you are having with this module. I haven't used it in a bit -- although, when I did use it some time ago, I don't recall having any sort of issues with it.

      In regards to support, the Jabber protocol is better documented then any of the other commonly used instant messanging platforms. That being the case, I can't imagine that any other instant messaging system would as simple to program for as Jabber is. But in regards to the actual support of the Net::Jabber module itself, if you feel there is a bug, the author seems to be available to talk to about that, although I haven't tried myself. You can go to the Net::Jabber CPAN page or XML::Stream::Parser page, and email the author regarding the problems you are having. If you feel that you definitely have found a bug, he even includes a link labeled "View Reported Bugs", where you can both view existing bugs, and report new ones.

      Good luck!
      -Eric

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://159832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-09-01 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (18 votes), past polls