lib/aim/net_toc.rb in remi-aim-0.1.0 vs lib/aim/net_toc.rb in remi-aim-0.1.1
- old
+ new
@@ -529,11 +529,13 @@
keep_track_of_rooms_joined unless keeping_track_of_rooms_joined?
add_callback(:chat_in) do |val|
puts "chat_in val => #{ val.inspect }"
room_id, screen_name, auto, *message = *val.split(":")
message = message.join(":")
+ message = message.gsub('<br>',"\n") # ... before getting rid of html
message = message.chomp.gsub(/<[^>]+>/,"") # get rid of html
+ message = message.gsub("\n",'<br />') # ... turn newlines back into br's
buddy = @buddy_list.buddy_named(screen_name)
room = @rooms[room_id] || room_id
auto_response = auto == "T"
yield message, buddy, room, auto_response
end
@@ -564,9 +566,13 @@
# Sets your idle time in seconds. You only need to set this once; afterwards, the server will keep track itself.
# Set to 0 to stop being idle.
def idle_time=(seconds)
@conn.toc_set_idle seconds
+ end
+
+ def clear_callbacks!
+ @callbacks = { }
end
# Waits for the event-handling thread for +limit+ seconds, or indefinitely if no argument is given. Use this to prevent your program from exiting prematurely.
# For example, the following script will exit right after connecting:
# client = Net::TOC.new("screenname", "p455w0rd")