Changeset 5501

Show
Ignore:
Timestamp:
01/25/08 17:01:04 (10 months ago)
Author:
cho45
Message:

lang/ruby/misc/lig.rb:

Use user_id for identity and always show it.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/misc/lig.rb

    r5491 r5501  
    104104                        @log.info "Client Option: #{@opts.join(", ")}" 
    105105                        @log.info "Client initialization is completed." 
     106 
     107                        @user_info = @lingr.get_user_info[:response] 
    106108                end 
    107109 
     
    139141 
    140142                        if @channels[channel] 
     143                                @channels[channel][:observer].kill 
    141144                                @lingr.exit_room(@channels[channel][:ticket]) 
    142145                                @channels.delete(channel) 
     
    155158                                                :o_id     => res["occupant_id"], 
    156159                                                :hcounter => 0, 
     160                                                :observer => Thread.current, 
    157161                                        } 
    158162                                        first = true 
     
    166170                                                                next if m["id"].to_i <= info[:hcounter] 
    167171 
    168                                                                 nick = m["nickname"] 
     172                                                                u_id = m["user_id"] 
    169173                                                                o_id = m["occupant_id"] 
     174                                                                nick = m["nickname"].gsub(/\s+/, "") + "^#{u_id || "anon"}" 
    170175 
    171176                                                                case m["type"] 
     
    179184                                                                        # TOOD 
    180185                                                                when "system:enter" 
    181                                                                         @s << Message.new("#{nick}!#{o_id}@lingr.com", "JOIN", [chan]) unless nick == @nick 
     186                                                                        @s << Message.new("#{nick}!#{o_id}@lingr.com", "JOIN", [chan]) unless u_id == @user_info["user_id"] 
    182187                                                                when "system:leave" 
    183                                                                         @s << Message.new("#{nick}!#{o_id}@lingr.com", "PART", [chan]) unless nick == @nick 
     188                                                                        @s << Message.new("#{nick}!#{o_id}@lingr.com", "PART", [chan]) unless u_id == @user_info["user_id"] 
    184189                                                                when /system:/ 
    185190                                                                        log m["text"]