- Implemented (weak) handling for a 310 "Redirect" server response.
This commit is contained in:
Paul Beckingham 2013-07-14 12:25:31 -04:00
parent a5a38a1137
commit dd14388b1b
5 changed files with 17 additions and 2 deletions

View file

@ -209,6 +209,7 @@ int CmdSync::execute (std::string& output)
// Present a clear status message.
if (upload_count == 0 && download_count == 0)
// Note: should not happen - expect code 201 instead.
context.footnote (STRING_CMD_SYNC_SUCCESS0);
else if (upload_count == 0 && download_count > 0)
context.footnote (format (STRING_CMD_SYNC_SUCCESS2, download_count));
@ -222,6 +223,13 @@ int CmdSync::execute (std::string& output)
{
context.footnote (STRING_CMD_SYNC_SUCCESS_NOP);
}
else if (code == "301")
{
std::string new_server = response.get ("info");
context.config.set ("taskd.server", new_server);
context.error (STRING_CMD_SYNC_RELOCATE0);
context.error (" " + format (STRING_CMD_SYNC_RELOCATE1, new_server));
}
else if (code == "430")
{
context.error (STRING_CMD_SYNC_FAIL_ACCOUNT);
@ -235,7 +243,7 @@ int CmdSync::execute (std::string& output)
status = 2;
}
// Display all errors returned. This is required by the server protocol.
// Display all errors returned. This is recommended by the server protocol.
std::string to_be_displayed = response.get ("messages");
if (to_be_displayed != "")
{

View file

@ -420,6 +420,8 @@
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
#define STRING_CMD_SYNC_INIT "Please confirm that you wish to upload all your pending tasks to the Task Server"
#define STRING_CMD_SYNC_NO_INIT "Taskwarrior will not proceed with first-time sync initialization."
#define STRING_CMD_SYNC_RELOCATE0 "The server account has been relocated. Please update your configuration using:"
#define STRING_CMD_SYNC_RELOCATE1 "task config taskd.server {1}"
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
#define STRING_CMD_DIAG_PLATFORM "Platform"
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"

View file

@ -430,8 +430,9 @@
#define STRING_CMD_SYNC_BAD_SERVER "Sincronización fallida. Ajuste de configuración '{1}' incorrecto"
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior fue construido sin soporte GnuTLS. Sincronización no disponible."
#define STRING_CMD_SYNC_INIT "Por favor, confirme que desea subir todas sus tareas pendientes al Servidor Task"
#define STRING_CMD_SYNC_NO_INIT "Taskwarrior will not proceed with first-time sync initialization."
#define STRING_CMD_SYNC_NO_INIT "Taskwarrior will no procederá a la inicialización de la sincronización por primera vez."
#define STRING_CMD_SYNC_RELOCATE0 "The server account has been relocated. Please update your configuration using:"
#define STRING_CMD_SYNC_RELOCATE1 "task config taskd.server {1}"
#define STRING_CMD_DIAG_USAGE "Detalles de plataforma, construcción y entorno"
#define STRING_CMD_DIAG_PLATFORM "Plataforma"
#define STRING_CMD_DIAG_UNKNOWN "<desconocido>"

View file

@ -420,6 +420,8 @@
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
#define STRING_CMD_SYNC_INIT "Please confirm that you wish to upload all your pending tasks to the Task Server"
#define STRING_CMD_SYNC_NO_INIT "Taskwarrior will not proceed with first-time sync initialization."
#define STRING_CMD_SYNC_RELOCATE0 "The server account has been relocated. Please update your configuration using:"
#define STRING_CMD_SYNC_RELOCATE1 "task config taskd.server {1}"
#define STRING_CMD_DIAG_USAGE "Platform, build and environment details"
#define STRING_CMD_DIAG_PLATFORM "Platform"
#define STRING_CMD_DIAG_UNKNOWN "<unknown>"

View file

@ -421,6 +421,8 @@
#define STRING_CMD_SYNC_NO_TLS "Taskwarrior was built without GnuTLS support. Sync is not available."
#define STRING_CMD_SYNC_INIT "Please confirm that you wish to upload all your pending tasks to the Task Server"
#define STRING_CMD_SYNC_NO_INIT "Taskwarrior will not proceed with first-time sync initialization."
#define STRING_CMD_SYNC_RELOCATE0 "The server account has been relocated. Please update your configuration using:"
#define STRING_CMD_SYNC_RELOCATE1 "task config taskd.server {1}"
#define STRING_CMD_DIAG_USAGE "Dettagli su piattaforma, build e ambiente"
#define STRING_CMD_DIAG_PLATFORM "Piattaforma"
#define STRING_CMD_DIAG_UNKNOWN "<sconoscito>"