Author: nornagon
Date: 2005-07-05 20:25:10 -0400 (Tue, 05 Jul 2005)
New Revision: 841

Modified:
   trunk/clients/ravish/ravish2.rb
Log:
/say, /me, and probably some other stuff too

Modified: trunk/clients/ravish/ravish2.rb
===================================================================
--- trunk/clients/ravish/ravish2.rb     2005-07-05 23:54:04 UTC (rev 840)
+++ trunk/clients/ravish/ravish2.rb     2005-07-06 00:25:10 UTC (rev 841)
@@ -1,6 +1,6 @@
 # ravish -- Haver client written in ruby. Second attempt.
 
-$:.unshift "lib"
+$:.unshift "/home/nornagon/dev/termvisual/lib"
 
 require 'term/visual'
 require 'haver'
@@ -71,6 +71,7 @@
                        # command
                        args = $1.split(/ /)
                        cmd = args.shift
+                       if cmd.empty? then return self.user_nocmd(args.join(' 
')) end
                        func = "user_" + cmd.upcase
                        if self.respond_to?(func)
                                self.send func, args
@@ -179,6 +180,8 @@
                                @term.switch_window win
                        end
                        @haver.msg 'LIST', cid, 'user'
+               elsif win = find_window(cid)
+                       win[1].print "#{uid} has joined #{cid}"
                end
        end
 
@@ -203,7 +206,7 @@
                        pref = "%(nickdecs)<%(" + (uid == @nick ? 'my' : '') + 
"nick)" +
                                   "#{uid}%(nickdecs)>%(default) "
                elsif type == 'do'
-                       pref = "%(donick)* #{uid}%(default)"
+                       pref = "%(donick)* #{uid}%(default) "
                end
                if win = find_window(cid)
                        win[1].addline msg.join(' '), pref      
@@ -224,11 +227,35 @@
                        @haver.msg 'IN', win[0], 'say', line
                end
        end
+       
+       def user_SAY args
+               win = find_window(@term.current_window)
+               unless win[0] == '(server)'
+                       @haver.msg 'IN', win[0], 'say', args.join(' ')
+               end
+       end
 
+       def user_ME line
+               win = find_window(@term.current_window)
+               unless win[0] == '(server)'
+                       @haver.msg 'IN', win[0], 'do', line
+               end
+       end
+
        def user_JOIN args
                @haver.msg 'JOIN', args[0]
        end
 
+       def user_NAMES args
+               if args[0] and args[1]
+                       @haver.msg 'LIST', args[0], args[1]
+               elsif args[0] and not args[1]
+                       @haver.msg 'LIST', args[0], 'user'
+               elsif win = find_window(@term.current_window) and win[0] != 
'(server)'
+                       @haver.msg 'LIST', win[0], 'user'
+               end
+       end
+
        def user_RAW args
                @haver.msg args.shift.upcase, *args
        end


Reply via email to