equal
deleted
inserted
replaced
22 } |
22 } |
23 |
23 |
24 public Module[] modules; |
24 public Module[] modules; |
25 |
25 |
26 public signal void state_changed(State old_state, State new_state, string description); |
26 public signal void state_changed(State old_state, State new_state, string description); |
|
27 public signal void check_time(); |
27 protected void _change_state(State new_state, string description) { |
28 protected void _change_state(State new_state, string description) { |
28 var old_state = this._state; |
29 var old_state = this._state; |
29 if (old_state != new_state) { |
30 if (old_state != new_state) { |
30 this._state = new_state; |
31 this._state = new_state; |
31 stderr.printf("State changed %s -> %s : %s\n",old_state.to_string(), new_state.to_string(), description); |
32 stderr.printf("State changed %s -> %s : %s\n",old_state.to_string(), new_state.to_string(), description); |
88 /*var room = new Conference(this, "говнохост@conference.blasux.ru", "Ζαλυπα"); |
89 /*var room = new Conference(this, "говнохост@conference.blasux.ru", "Ζαλυπα"); |
89 room.join("Oh hai"); |
90 room.join("Oh hai"); |
90 this.rooms[room.jid] = room;*/ |
91 this.rooms[room.jid] = room;*/ |
91 } |
92 } |
92 }); |
93 }); |
|
94 check_time.connect( () => { |
|
95 if (_state == State.DISCONNECTED) |
|
96 open(); |
|
97 }); |
93 } |
98 } |
94 public void open() { |
99 public void open() { |
95 |
100 |
96 stderr.printf("Connecting to %s:%d as %s\n",server,port,jid); |
101 stderr.printf("Connecting to %s:%d as %s\n",server,port,jid); |
97 cn.set_port(port); |
102 cn.set_port(port); |
135 }); |
140 }); |
136 log("LM", LogLevelFlags.LEVEL_DEBUG, "HATE HATE"); |
141 log("LM", LogLevelFlags.LEVEL_DEBUG, "HATE HATE"); |
137 var cfg = new Config.from_file(args[1]); |
142 var cfg = new Config.from_file(args[1]); |
138 var loop = new MainLoop(); |
143 var loop = new MainLoop(); |
139 var account = new Connection(cfg); |
144 var account = new Connection(cfg); |
140 account.open(); |
145 //account.open(); |
141 stdout.printf("Fuck yeah\n"); |
146 stdout.printf("Fuck yeah\n"); |
|
147 var checktimer = new TimeoutSource(2000); |
|
148 checktimer.set_callback(() => { |
|
149 account.check_time(); |
|
150 //stderr.printf("TimeoutSource OLOLO\n"); |
|
151 return true; |
|
152 }); |
|
153 checktimer.attach(loop.get_context()); |
142 loop.run(); |
154 loop.run(); |
143 return 0; |
155 return 0; |
144 } |
156 } |