Changeset dd16bdd for perlwrap.pm


Ignore:
Timestamp:
Oct 27, 2006, 1:19:54 AM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1b6b2f3
Parents:
39c036d
Message:
Initial support for creating and injecting messages into the
display. Note that at the moment, you can easily segfault owl from
perl by injecting messages that don't contain fields owl assumes they
will.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlwrap.pm

    r6922edd rdd16bdd  
    6262package owl::Message;
    6363
     64sub new {
     65    my $class = shift;
     66    my %args = (@_);
     67    if($class eq __PACKAGE__ && $args{type}) {
     68        $class = "owl::Message::" . ucfirst $args{type};
     69    }
     70    return bless {%args}, $class;
     71}
     72
    6473sub type        { return shift->{"type"}; }
    6574sub direction   { return shift->{"direction"}; }
     
    8493sub is_admin    { return (shift->{"type"} eq "admin"); }
    8594sub is_generic  { return (shift->{"type"} eq "generic"); }
     95sub is_jabber   { return (shift->{"type"} eq "jabber"); }
    8696
    8797# These are overridden by appropriate message types
     
    251261#####################################################################
    252262
     263package owl::Message::Jabber;
     264
     265@ISA = qw( owl::Message );
     266
     267#####################################################################
     268#####################################################################
     269
    253270# switch to package main when we're done
    254271package main;
Note: See TracChangeset for help on using the changeset viewer.