Author: bdonlan
Date: 2004-06-03 20:49:10 -0400 (Thu, 03 Jun 2004)
New Revision: 219

Modified:
   trunk/haver-gtk/bin/haver-gtk.pl
Log:
Make cmd_say check if the current page can handle that kind of op

Modified: trunk/haver-gtk/bin/haver-gtk.pl
===================================================================
--- trunk/haver-gtk/bin/haver-gtk.pl    2004-06-04 00:38:30 UTC (rev 218)
+++ trunk/haver-gtk/bin/haver-gtk.pl    2004-06-04 00:49:10 UTC (rev 219)
@@ -413,7 +413,13 @@
 
 sub cmd_say {
        my ($kernel, $heap, $args) = @_[KERNEL, HEAP, ARG1];
-       $pages->get_current_page()->send_msg(q{"}, $args->[0]);
+       my $cpage = $pages->get_current_page();
+       if ($cpage->can('send_msg')) {
+               $pages->get_current_page()->send_msg(q{"}, $args->[0]);
+       } else {
+               # XXX: error handling framework that won't corrupt rawlog, etc
+               $cpage->print_page("You can't talk in this kind of page.");
+       }
 }
 
 sub cmd_quit { goto &quit; }
@@ -486,7 +492,7 @@
 
 sub cmd_me {
        my ($kernel, $heap, $args) = @_[KERNEL,HEAP,ARG1];
-       return unless($pages->get_current_page()->can('send_msg'));
+       return unless($pages->get_current_page()->can('send_msg')); # XXX: 
error reporting
        $pages->get_current_page()->send_msg(q{:}, $args->[0]);
 }
 


Reply via email to