~julien-spautz/cable/model-view

« back to all changes in this revision

Viewing changes to src/Backend/Client.vala

  • Committer: Julien Spautz
  • Date: 2013-07-30 00:52:16 UTC
  • Revision ID: spautz.julien@gmail.com-20130730005216-chro25g4728950sd
fixed issued with renaming, some internal changes, created autoscrolled class, stub controller class

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***
2
 
    Copyright (C) 2013 Cable Developers
3
 
 
4
 
    This program or library is free software; you can redistribute it
5
 
    and/or modify it under the terms of the GNU Lesser General Public
6
 
    License as published by the Free Software Foundation; either
7
 
    version 3 of the License, or (at your option) any later version.
8
 
 
9
 
    This library is distributed in the hope that it will be useful,
10
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
 
    Lesser General Public License for more details.
13
 
 
14
 
    You should have received a copy of the GNU Lesser General
15
 
    Public License along with this library; if not, write to the
16
 
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 
    Boston, MA 02110-1301 USA.
18
 
***/
19
 
 
20
 
class Cable.Backend.Client : GLib.Object {
21
 
 
22
 
    static string[] _server_names;
23
 
    public static string[] server_names {
24
 
        get { return _server_names = client.servers (); }
25
 
    }
26
 
 
27
 
    /*public static string config_get (string group, string key) throws GLib.IOError {
28
 
        return client.config_get (group, key);
29
 
    }
30
 
 
31
 
    public static void config_set (string group, string key, string value) throws GLib.IOError {
32
 
        client.action (group, key, value);
33
 
    }*/
34
 
 
35
 
    public static string? get_server_name (string nick, string address) {
36
 
        foreach (var server in server_names) {
37
 
            var config = new ServerConfig (server);
38
 
            if (config["nick"] == nick && config["address"] == address)
39
 
                return server;
40
 
        }
41
 
        return (string) null;
42
 
    }
43
 
}