aboutsummaryrefslogtreecommitdiffstats
path: root/storage_xml.c
diff options
context:
space:
mode:
authorSven Moritz Hallberg <pesco@khjk.org>2009-03-12 20:10:06 +0100
committerSven Moritz Hallberg <pesco@khjk.org>2009-03-12 20:10:06 +0100
commit823de9d44f262ea2364ac8ec6a1e18e0f7dab658 (patch)
treebfe64e4fafbcd13aaef6a436cab6ad91619e2821 /storage_xml.c
parent9b55485a6f9d72334b372e6fb6b60bbde943170d (diff)
commit updates by ashish shukla <wahjava@gmail.com>
Diffstat (limited to 'storage_xml.c')
-rw-r--r--storage_xml.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/storage_xml.c b/storage_xml.c
index 240206f1..09e2f328 100644
--- a/storage_xml.c
+++ b/storage_xml.c
@@ -28,7 +28,14 @@
#include "base64.h"
#include "arc.h"
#include "md5.h"
+
+#if GLIB_CHECK_VERSION(2,8,0)
#include <glib/gstdio.h>
+#else
+/* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */
+#include <unistd.h>
+#define g_access access
+#endif
#if !GLIB_CHECK_VERSION(2,8,0)
/* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */
@@ -255,7 +262,7 @@ static void xml_init( void )
log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir );
}
-static storage_status_t xml_load_real( const char *my_nick, const char *password, irc_t *irc, xml_pass_st action )
+static storage_status_t xml_load_real( irc_t *irc, const char *my_nick, const char *password, xml_pass_st action )
{
GMarkupParseContext *ctx;
struct xml_parsedata *xd;
@@ -263,9 +270,6 @@ static storage_status_t xml_load_real( const char *my_nick, const char *password
GError *gerr = NULL;
int fd, st;
- if( irc && irc->status & USTATUS_IDENTIFIED )
- return( 1 );
-
xd = g_new0( struct xml_parsedata, 1 );
xd->irc = irc;
xd->given_nick = g_strdup( my_nick );
@@ -317,21 +321,19 @@ static storage_status_t xml_load_real( const char *my_nick, const char *password
if( action == XML_PASS_CHECK_ONLY )
return STORAGE_OK;
- irc->status |= USTATUS_IDENTIFIED;
-
return STORAGE_OK;
}
-static storage_status_t xml_load( const char *my_nick, const char *password, irc_t *irc )
+static storage_status_t xml_load( irc_t *irc, const char *password )
{
- return xml_load_real( my_nick, password, irc, XML_PASS_UNKNOWN );
+ return xml_load_real( irc, irc->nick, password, XML_PASS_UNKNOWN );
}
static storage_status_t xml_check_pass( const char *my_nick, const char *password )
{
/* This is a little bit risky because we have to pass NULL for the
irc_t argument. This *should* be fine, if I didn't miss anything... */
- return xml_load_real( my_nick, password, NULL, XML_PASS_CHECK_ONLY );
+ return xml_load_real( NULL, my_nick, password, XML_PASS_CHECK_ONLY );
}
static int xml_printf( int fd, int indent, char *fmt, ... )
@@ -367,12 +369,6 @@ static storage_status_t xml_save( irc_t *irc, int overwrite )
md5_byte_t pass_md5[21];
md5_state_t md5_state;
- if( irc->password == NULL )
- {
- irc_usermsg( irc, "Please register yourself if you want to save your settings." );
- return STORAGE_OTHER_ERROR;
- }
-
path2 = g_strdup( irc->nick );
nick_lc( path2 );
g_snprintf( path, sizeof( path ) - 2, "%s%s%s", global.conf->configdir, path2, ".xml" );