1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Updated RubyTest plugin

This commit is contained in:
James Booth 2013-08-29 00:22:32 +01:00
parent 1a17db2046
commit 237eb692b7
2 changed files with 21 additions and 8 deletions

View File

@ -1,8 +1,9 @@
module RubyTest
def self.prof_init(version, status)
Prof::cons_show("RubyTest: init, " + version + ", " + status)
Prof::register_command("/ruby", 0, 1, "/ruby", "RubyTest", "RubyTest", cmd_ruby)
Prof::register_timed(timer_test, 5)
Prof::register_timed(timer_test, 10)
end
def self.prof_on_start()
@ -18,20 +19,32 @@ module RubyTest
end
def self.cmd_ruby()
return Proc.new {
| msg |
return Proc.new { | msg |
if msg
Prof::cons_show("Ruby command called: " + msg)
Prof::cons_show("RubyTest: /ruby command called, arg = " + msg)
else
Prof::cons_show("Ruby command called with no arg")
Prof::cons_show("RubyTest: /ruby command called with no arg")
end
Prof::cons_alert
Prof::notify("RubyTest: notify", 2000, "Plugins")
Prof::send_line("/help")
Prof::cons_show("RubyTest: sent \"/help\" command")
}
end
def self.timer_test()
return Proc.new {
Prof::cons_show("Ruby timer fired.")
Prof::cons_show("RubyTest: timer fired.")
recipient = Prof::get_current_recipient
if recipient
Prof::cons_show(" current recipient = " + recipient)
end
Prof::cons_alert
}
end
def self.on_message_received(jid, message)
Prof::cons_show("RubyTest: on_message_received, jid = " + jid + ", message = " + message)
Prof::cons_alert
end
end

View File

@ -43,7 +43,7 @@ ruby_api_cons_show(VALUE self, VALUE v_message)
if (message != NULL) {
api_cons_show(message);
}
return self;
return Qnil;
}
static VALUE