2 require 'plugins/plugin'
3 require 'require_bundle'
4 require 'action_provider'
5 require_bundle 'ics', 'protocol'
6 require_bundle 'ics', 'connection'
7 require_bundle 'ics', 'match_handler'
11 include ActionProvider
13 plugin :name => 'ICS Plugin',
14 :interface => :action_provider,
19 :text => KDE.i18n("&Connect to ICS"),
20 :icon => 'network-connect') do |parent|
21 connect_to_ics(parent)
24 :text => KDE.i18n("&Disconnect from ICS"),
25 :icon => 'network-disconnect') do |parent|
33 def connect_to_ics(parent)
34 protocol = ICS::Protocol.new(:debug)
35 @connection = ICS::Connection.new('freechess.org', 23)
36 config = KDE::Global.config.group("ICS")
37 protocol.add_observer ICS::AuthModule.new(@connection,
38 config.read_entry('username', 'guest'),
39 config.read_entry('password', ''))
40 protocol.add_observer ICS::StartupModule.new(@connection)
41 protocol.link_to @connection
43 protocol.observe :text do |text|
44 parent.console.append(text)
47 parent.console.observe :input do |text|
48 @connection.send_text text
51 @handler = ICS::MatchHandler.new(parent.controller,