1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00
profanity/plugins/RubyTest.rb

54 lines
1.7 KiB
Ruby
Raw Normal View History

2013-08-18 15:11:16 -04:00
module RubyTest
2013-08-28 19:22:32 -04:00
def self.prof_init(version, status)
2013-08-18 17:22:14 -04:00
Prof::cons_show("RubyTest: init, " + version + ", " + status)
2013-08-18 18:54:56 -04:00
Prof::register_command("/ruby", 0, 1, "/ruby", "RubyTest", "RubyTest", cmd_ruby)
2013-08-28 19:22:32 -04:00
Prof::register_timed(timer_test, 10)
2013-08-18 17:22:14 -04:00
end
def self.prof_on_start()
2013-08-18 17:22:14 -04:00
Prof::cons_show("RubyTest: on_start")
end
def self.prof_on_connect(account_name, fulljid)
Prof::cons_show("RubyTest: on_connect, " + account_name + ", " + fulljid)
2013-08-18 17:22:14 -04:00
end
def self.prof_on_message_received(jid, message)
2013-08-18 17:22:14 -04:00
Prof::cons_show("RubyTest: on_message_received, " + jid + ", " + message)
2013-08-28 19:48:39 -04:00
Prof::cons_alert
return message + "[RUBY]"
2013-08-18 15:11:16 -04:00
end
2013-08-18 18:54:56 -04:00
2013-08-31 16:11:28 -04:00
def self.prof_on_message_send(jid, message)
Prof::cons_show("RubyTest: on_message_send, " + jid + ", " + message)
Prof::cons_alert
return message + "[RUBY]"
end
def self.cmd_ruby()
2013-08-28 19:22:32 -04:00
return Proc.new { | msg |
2013-08-18 18:54:56 -04:00
if msg
2013-08-28 19:22:32 -04:00
Prof::cons_show("RubyTest: /ruby command called, arg = " + msg)
2013-08-18 18:54:56 -04:00
else
2013-08-28 19:22:32 -04:00
Prof::cons_show("RubyTest: /ruby command called with no arg")
2013-08-18 18:54:56 -04:00
end
2013-08-28 19:22:32 -04:00
Prof::cons_alert
Prof::notify("RubyTest: notify", 2000, "Plugins")
Prof::send_line("/help")
Prof::cons_show("RubyTest: sent \"/help\" command")
2013-08-18 18:54:56 -04:00
}
end
def self.timer_test()
2013-08-18 18:54:56 -04:00
return Proc.new {
2013-08-28 19:22:32 -04:00
Prof::cons_show("RubyTest: timer fired.")
recipient = Prof::get_current_recipient
if recipient
2013-08-28 19:36:09 -04:00
Prof::cons_show(" current recipient = " + recipient)
2013-08-28 19:22:32 -04:00
end
Prof::cons_alert
2013-08-18 18:54:56 -04:00
}
end
2013-08-18 15:11:16 -04:00
end