CLI for XMPP in C
0

Configure Feed

Select the types of activity you want to include in your feed.

Bugfix: Key file does not have group ?default?

Bugfix for checking if configuration file exists. Also did some argv
parameter checks.

Issue: #26

+32 -12
+5
changelog
··· 1 + 2020-05-16 Stefan Kropp <stefan.kropp@posteo.de> 2 + Release 0.1.1 3 + * Display help, if no parameter has been set 4 + * fixed g_error_matches handling for config file 5 + 1 6 2020-05-16 DebXWoody <stefan@debxwoody.de> 2 7 3 8 Release 0.1.0
+1 -1
configure.ac
··· 1 - AC_INIT([xmppc], [0.1.0], [stefan@debxwoody.de]) 1 + AC_INIT([xmppc], [0.1.1], [stefan.kropp@posteo.de]) 2 2 AC_CONFIG_AUX_DIR([build-aux]) 3 3 AC_CONFIG_MACRO_DIR([m4]) 4 4 AC_CONFIG_SRCDIR([src/main.c])
+26 -11
src/main.c
··· 338 338 printf("!!! WARNING: XMPPC is running in development mode !!!\n"); 339 339 #endif 340 340 341 + if(argc < 2) { 342 + _show_help(); 343 + return EXIT_FAILURE; 344 + } 345 + 341 346 INIT_XMPPC(xmppc); 342 347 343 348 static int verbose_flag = 0; ··· 425 430 &error); 426 431 427 432 if (!configfilefound) { 428 - if(!g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { 429 - logError(&xmppc, "Error loading key file: %s", error->message); 430 - return -1; 433 + if(error && !g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { 434 + logError(&xmppc, "Error loading key file: %s\n", error->message); 435 + return EXIT_FAILURE; 431 436 } 432 - } else { 433 - if(jid == NULL && pwd == NULL) { 434 - logInfo(&xmppc,"Loading default account\n"); 435 - if( account == NULL ) { 436 - account = "default"; 437 - } 438 - jid = g_key_file_get_value (config_file, account, "jid" ,&error); 439 - pwd = g_key_file_get_value (config_file, account, "pwd" ,&error); 437 + if(jid == NULL && account == NULL) { 438 + printf("You need either --jid or --account parameter or a default account\n"); 439 + _show_help(); 440 + return EXIT_FAILURE; 440 441 } 442 + } 443 + error = NULL; 444 + 445 + if(jid == NULL && pwd == NULL) { 446 + logInfo(&xmppc,"Loading default account\n"); 447 + if( account == NULL ) { 448 + account = "default"; 449 + } 450 + jid = g_key_file_get_value (config_file, account, "jid" ,&error); 451 + if( error ) { 452 + logError(&xmppc, "No jid found in configuration file. %s\n", error->message); 453 + return EXIT_FAILURE; 454 + } 455 + pwd = g_key_file_get_value (config_file, account, "pwd" ,&error); 441 456 } 442 457 443 458 if ( !pwd ) {