1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
10 :disconnected => { :permanent => '', :temporary => KDE.i18n("Disconnected from ICS Server") },
11 :established => { :temporary => KDE.i18n("Connection established") },
12 :connecting => { :permanent => KDE.i18n("Connecting...") },
13 :logging_in => { :permanent => KDE.i18n("Logging in...") },
14 :logged_in => { :temporary => KDE.i18n("Logged in"), :permanent => KDE.i18n("Connected to ICS server") }
17 def initialize(set_temporary, set_permanent)
18 @set_temporary = set_temporary
19 @set_permanent = set_permanent
20 switch_to(:disconnected)
23 def link_to(connection, protocol)
24 connection.on(:connecting) { switch_to :connecting }
25 connection.on(:established) { switch_to :established }
26 connection.on(:closed) { switch_to :disconnected }
27 protocol.on(:login_prompt) { switch_to :logging_in }
28 protocol.observe_limited(:prompt) do
36 messages = MESSAGES[state]
38 @set_permanent[messages[:permanent]] if messages[:permanent]
39 @set_temporary[messages[:temporary]] if messages[:temporary]