iswydt.vala
changeset 2 4e050075fab9
parent 1 76caf6a3f413
child 3 dd7a02c6d476
--- a/iswydt.vala	Fri Oct 19 00:38:54 2012 +0400
+++ b/iswydt.vala	Tue Oct 23 18:33:49 2012 +0400
@@ -24,6 +24,7 @@
     public Module[] modules;
 
     public signal void state_changed(State old_state, State new_state, string description);
+    public signal void check_time();
     protected void _change_state(State new_state, string description) {
         var old_state = this._state;
         if (old_state != new_state) {
@@ -90,6 +91,10 @@
                 this.rooms[room.jid] = room;*/
             }
         });
+        check_time.connect( () => {
+            if (_state == State.DISCONNECTED)
+                open();
+        });
     }
     public void open() {
 
@@ -137,8 +142,15 @@
     var cfg = new Config.from_file(args[1]);
     var loop = new MainLoop();
     var account = new Connection(cfg);
-    account.open();
+    //account.open();
     stdout.printf("Fuck yeah\n");
+    var checktimer = new TimeoutSource(2000);
+    checktimer.set_callback(() => {
+        account.check_time();
+        //stderr.printf("TimeoutSource OLOLO\n");
+        return true;
+    });
+    checktimer.attach(loop.get_context());
     loop.run();
     return 0;
 }