Commit 5e6d71de authored by Jonathan Michalon's avatar Jonathan Michalon
Browse files

Made libovccclient's vala part compile (but not C...)

parent 0c2f3011
using OVCC;
namespace OVCCClient
{
......@@ -15,7 +16,7 @@ namespace OVCCClient
public Client (Player p)
{
player = p;
Object (player: p);
}
public bool bind_to (Server s)
......@@ -23,17 +24,23 @@ namespace OVCCClient
{
if (server != null)
{
throw new ALREADY_BOUND ("This client is already bound to a server");
throw new ClientError.ALREADY_BOUND ("This client is already bound to a server");
}
server = s;
server.connect (player);
try {
server.connect_to (player);
} catch {}
return false;
}
public bool leave ()
{
/* destroy server */
server = null;
return false;
}
}
}
using OVCC;
namespace OVCCClient
{
......@@ -22,42 +23,48 @@ namespace OVCCClient
public class Server : Object
{
private string host;
private uint16 port;
private SocketClient socket;
private SocketConnexion connexion;
private string host;
private uint16 port;
private SocketClient socket;
private SocketConnection connection;
public Server (string host,
uint port)
uint16 port)
{
socket = new SocketClient ();
host = host;
port = port;
this.host = host;
this.port = port;
}
~Server ()
{
connexion.close ();
connection.close ();
}
public /*async*/ bool connect (Player player)
public /*async*/ bool connect_to (Player player)
throws ServerError
{
bool ok = true;
try {
connexion = socket.connect (host, port, null);
} catch {} /* ... */
SocketConnectable addr = NetworkAddress.parse (host, port);
connection = socket.connect (addr);
} catch {
ok = false;
} /* ... */
return ok;
}
public List<OVCC.Game> enumerate_tables (TablesFilter filter)
public List<OVCC.Game>? enumerate_tables (TablesFilter filter)
{
return null;
}
/* join a table, index -1 means any open table
* The index is typically within the list returned by enumerate_tables() */
public Game join_table (int index)
public Game? join_table (int index)
throws ServerError
{
return null;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment