Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Experiences with IM support?

by Mur (Pilgrim)
on Apr 17, 2002 at 13:53 UTC ( [id://159811]=perlquestion: print w/replies, xml ) Need Help??

Mur has asked for the wisdom of the Perl Monks concerning the following question:

I want to add instant-message support to a daemon process: that is, the daemon would have a table of instant message addresses for those who support the system, and when errors or unusual conditions occur, the daemon would notify us via IM (instead of just email as it now does).

Has anyone done this before? (Doubtless.) Which IM clients have you used successfully, and which have been abject failures for this sort of thing? Personally, I use AOLIM, Yahoo!, and ICQ because I have co-workers and friends on all three. I experimented with Net::ICQ and was underwhelmed (may have just been my inability to tinker it into a working state). I just finished repeating that experiment with AOLIM, and it worked a bit better. I'm about to move on to Yahoo.

-- 
Jeff Boes                            vox 616.226.9550 ext 24
Database Engineer                           fax 616.349.9076
Nexcerpt, Inc.                       http://www.nexcerpt.com
        ...Nexcerpt...Connecting People With Expertise

Replies are listed 'Best First'.
Re: Experiences with IM support?
by andreychek (Parson) on Apr 17, 2002 at 14:49 UTC
    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
      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
Re: Experiences with IM support?
by lachoy (Parson) on Apr 17, 2002 at 14:19 UTC

    I don't have any specific advice, but you might want to poke around with Jabber. It supports gateways to mainstream IM services, but it's really more of a messaging platform than an IM server so would likely be much more flexible. It's got Perl support through Net::Jabber and Jabber::Connection, and an O'Reilly book as well. (The book seems well-done, but I'm only through a couple of chapters so far.)

    Chris
    M-x auto-bs-mode

      To all who noted that Jabber may be the way to go: wouldn't this require that the end-users have a Jabber account? In our environment, most have ICQ, but some don't; some have AOL, but not all; and so on.

        I think that's what you can use the gateway plugins for -- you should be able to send a message to a jabber server to tell it to forward the message to a user on another IM system. But I haven't tried this yet, so I'm not sure. Another thing working against you is that other IM systems aren't fond of making their protocols public, making it difficult to use them in any way other than they intended.

        Chris
        M-x auto-bs-mode

Re: Experiences with IM support?
by simon.proctor (Vicar) on Apr 17, 2002 at 14:24 UTC
    I have not done this before but have you considered the Jabber set of modules (Net::Jabber if memory serves). Oreilly have just released a book on the Jabber protocol as well so you should have a stronger position in developing for it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://159811]
Approved by jlk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 07:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found