mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 19:03:07 +02:00
Sync
- When taskwarrior is built without GnuTLS, there will be a message to that effect. - Stubbed the TLSClient calling code. The current Socket code will become obsolete soon.
This commit is contained in:
parent
157699cbde
commit
a973ccf8f2
7 changed files with 37 additions and 9 deletions
|
@ -90,7 +90,6 @@ check_function_exists (srandom HAVE_SRANDOM)
|
||||||
check_function_exists (timegm HAVE_TIMEGM)
|
check_function_exists (timegm HAVE_TIMEGM)
|
||||||
check_function_exists (get_current_dir_name HAVE_GET_CURRENT_DIR_NAME)
|
check_function_exists (get_current_dir_name HAVE_GET_CURRENT_DIR_NAME)
|
||||||
|
|
||||||
|
|
||||||
check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
|
check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
|
||||||
check_struct_has_member ("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_ST_BIRTHTIME)
|
check_struct_has_member ("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_ST_BIRTHTIME)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,11 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Socket.h>
|
#include <cmake.h>
|
||||||
|
#include <Socket.h> // TODO Socket is obsolete.
|
||||||
|
/*
|
||||||
|
#include <TLSClient.h>
|
||||||
|
*/
|
||||||
#include <Color.h>
|
#include <Color.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <i18n.h>
|
#include <i18n.h>
|
||||||
|
@ -51,6 +55,7 @@ CmdSync::CmdSync ()
|
||||||
int CmdSync::execute (std::string& output)
|
int CmdSync::execute (std::string& output)
|
||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
#ifdef HAVE_LIBGNUTLS
|
||||||
Timer timer_sync;
|
Timer timer_sync;
|
||||||
timer_sync.start ();
|
timer_sync.start ();
|
||||||
|
|
||||||
|
@ -244,6 +249,10 @@ int CmdSync::execute (std::string& output)
|
||||||
debug (s.str ());
|
debug (s.str ());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#else
|
||||||
|
// Without GnuTLS found at compile time, there is no working sync command.
|
||||||
|
throw std::string (STRING_CMD_SYNC_NO_TLS);
|
||||||
|
#endif
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +262,7 @@ bool CmdSync::send (
|
||||||
const Msg& request,
|
const Msg& request,
|
||||||
Msg& response)
|
Msg& response)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBGNUTLS
|
||||||
std::string::size_type colon = to.rfind (':');
|
std::string::size_type colon = to.rfind (':');
|
||||||
if (colon == std::string::npos)
|
if (colon == std::string::npos)
|
||||||
throw format (STRING_CMD_SYNC_BAD_SERVER, to);
|
throw format (STRING_CMD_SYNC_BAD_SERVER, to);
|
||||||
|
@ -262,6 +272,7 @@ bool CmdSync::send (
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// TODO Socket is obsolete.
|
||||||
Socket s;
|
Socket s;
|
||||||
s.connect (server, port);
|
s.connect (server, port);
|
||||||
s.write (request.serialize () + "\n");
|
s.write (request.serialize () + "\n");
|
||||||
|
@ -270,6 +281,21 @@ bool CmdSync::send (
|
||||||
s.read (incoming);
|
s.read (incoming);
|
||||||
s.close ();
|
s.close ();
|
||||||
|
|
||||||
|
/*
|
||||||
|
// A very basic TLS client, with X.509 authentication.
|
||||||
|
TLSClient client;
|
||||||
|
client.debug (); // TODO if (context.config.get ("debug"))
|
||||||
|
client.limit (1024); // TODO ???
|
||||||
|
client.init ("pki/client.cert.pem"); // TODO ???
|
||||||
|
client.connect (server, port);
|
||||||
|
|
||||||
|
client.send (request.serialize () + "\n");
|
||||||
|
|
||||||
|
std::string incoming;
|
||||||
|
client.recv (incoming);
|
||||||
|
client.bye ();
|
||||||
|
*/
|
||||||
|
|
||||||
response.parse (incoming);
|
response.parse (incoming);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -280,6 +306,7 @@ bool CmdSync::send (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate message failed.
|
// Indicate message failed.
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,6 +416,7 @@
|
||||||
#define STRING_CMD_SYNC_FAIL_ERROR "Sync failed. The Task Server returned error: {1} {2}"
|
#define STRING_CMD_SYNC_FAIL_ERROR "Sync failed. The Task Server returned error: {1} {2}"
|
||||||
#define STRING_CMD_SYNC_FAIL_CONNECT "Sync failed. Could not connect to the Task Server."
|
#define STRING_CMD_SYNC_FAIL_CONNECT "Sync failed. Could not connect to the Task Server."
|
||||||
#define STRING_CMD_SYNC_BAD_SERVER "Sync failed. Malformed configuration setting '{1}'"
|
#define STRING_CMD_SYNC_BAD_SERVER "Sync failed. Malformed configuration setting '{1}'"
|
||||||
|
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
|
||||||
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
|
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
|
||||||
#define STRING_CMD_DIAG_PLATFORM "Platform"
|
#define STRING_CMD_DIAG_PLATFORM "Platform"
|
||||||
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"
|
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"
|
||||||
|
|
|
@ -427,6 +427,7 @@
|
||||||
#define STRING_CMD_SYNC_FAIL_ERROR "Sincronización fallida. El Servidor Task devolvió error: {1} {2}"
|
#define STRING_CMD_SYNC_FAIL_ERROR "Sincronización fallida. El Servidor Task devolvió error: {1} {2}"
|
||||||
#define STRING_CMD_SYNC_FAIL_CONNECT "Sincronización fallida. No se pudo conectar con el Servidor Task."
|
#define STRING_CMD_SYNC_FAIL_CONNECT "Sincronización fallida. No se pudo conectar con el Servidor Task."
|
||||||
#define STRING_CMD_SYNC_BAD_SERVER "Sincronización fallida. Ajuste de configuración '{1}' incorrecto"
|
#define STRING_CMD_SYNC_BAD_SERVER "Sincronización fallida. Ajuste de configuración '{1}' incorrecto"
|
||||||
|
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
|
||||||
|
|
||||||
#define STRING_CMD_DIAG_USAGE "Detalles de plataforma, construcción y entorno"
|
#define STRING_CMD_DIAG_USAGE "Detalles de plataforma, construcción y entorno"
|
||||||
#define STRING_CMD_DIAG_PLATFORM "Plataforma"
|
#define STRING_CMD_DIAG_PLATFORM "Plataforma"
|
||||||
|
|
|
@ -416,6 +416,7 @@
|
||||||
#define STRING_CMD_SYNC_FAIL_ERROR "Sync failed. The Task Server returned error: {1} {2}"
|
#define STRING_CMD_SYNC_FAIL_ERROR "Sync failed. The Task Server returned error: {1} {2}"
|
||||||
#define STRING_CMD_SYNC_FAIL_CONNECT "Sync failed. Could not connect to the Task Server."
|
#define STRING_CMD_SYNC_FAIL_CONNECT "Sync failed. Could not connect to the Task Server."
|
||||||
#define STRING_CMD_SYNC_BAD_SERVER "Sync failed. Malformed configuration setting '{1}'"
|
#define STRING_CMD_SYNC_BAD_SERVER "Sync failed. Malformed configuration setting '{1}'"
|
||||||
|
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
|
||||||
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
|
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
|
||||||
#define STRING_CMD_DIAG_PLATFORM "Platform"
|
#define STRING_CMD_DIAG_PLATFORM "Platform"
|
||||||
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"
|
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"
|
||||||
|
|
|
@ -417,6 +417,7 @@
|
||||||
#define STRING_CMD_SYNC_FAIL_ERROR "Sincronizzazione fallita. Il Task Server ha ritornato l'errore: {1} {2}"
|
#define STRING_CMD_SYNC_FAIL_ERROR "Sincronizzazione fallita. Il Task Server ha ritornato l'errore: {1} {2}"
|
||||||
#define STRING_CMD_SYNC_FAIL_CONNECT "Sincronizzazione fallita. Impossibile connettersi al Task Server."
|
#define STRING_CMD_SYNC_FAIL_CONNECT "Sincronizzazione fallita. Impossibile connettersi al Task Server."
|
||||||
#define STRING_CMD_SYNC_BAD_SERVER "Sincronizzazione fallita. Impostazione di configurazione '{1}' malformata"
|
#define STRING_CMD_SYNC_BAD_SERVER "Sincronizzazione fallita. Impostazione di configurazione '{1}' malformata"
|
||||||
|
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
|
||||||
#define STRING_CMD_DIAG_USAGE "Dettagli su piattaforma, build e ambiente"
|
#define STRING_CMD_DIAG_USAGE "Dettagli su piattaforma, build e ambiente"
|
||||||
#define STRING_CMD_DIAG_PLATFORM "Piattaforma"
|
#define STRING_CMD_DIAG_PLATFORM "Piattaforma"
|
||||||
#define STRING_CMD_DIAG_UNKNOWN "<sconoscito>"
|
#define STRING_CMD_DIAG_UNKNOWN "<sconoscito>"
|
||||||
|
|
|
@ -16,21 +16,19 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
set (TESTBLOB "./*.t")
|
set (TESTBLOB "./*.t")
|
||||||
if (CYGWIN)
|
if (CYGWIN)
|
||||||
set (TESTBLOB "./*.t ./*.t.exe")
|
set (TESTBLOB "./*.t ./*.t.exe")
|
||||||
endif (CYGWIN)
|
endif (CYGWIN)
|
||||||
|
|
||||||
else (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
else (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t")
|
set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t")
|
||||||
if (CYGWIN)
|
if (CYGWIN)
|
||||||
set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t.exe")
|
set (TESTBLOB "${CMAKE_SOURCE_DIR}/test/*.t ${CMAKE_BINARY_DIR}/test/*.t.exe")
|
||||||
endif (CYGWIN)
|
endif (CYGWIN)
|
||||||
|
|
||||||
endif (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
endif (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
configure_file (
|
configure_file (run_all.in run_all)
|
||||||
run_all.in
|
|
||||||
run_all)
|
|
||||||
|
|
||||||
add_custom_target (test ./run_all --verbose
|
add_custom_target (test ./run_all --verbose
|
||||||
DEPENDS ${test_SRCS} task_executable
|
DEPENDS ${test_SRCS} task_executable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue