mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-12 06:52:13 +00:00
Avoid writing out a new xmpp.cfg file unless there's actually a change.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5888 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b3c469f106
commit
6ad33d4ad4
1 changed files with 17 additions and 0 deletions
|
@ -83,6 +83,7 @@ static struct
|
||||||
icefuncs_t *piceapi;
|
icefuncs_t *piceapi;
|
||||||
#endif
|
#endif
|
||||||
static qboolean jclient_needreadconfig;
|
static qboolean jclient_needreadconfig;
|
||||||
|
static qboolean jclient_configdirty;
|
||||||
static qboolean jclient_updatebuddylist;
|
static qboolean jclient_updatebuddylist;
|
||||||
static jclient_t *jclient_action_cl;
|
static jclient_t *jclient_action_cl;
|
||||||
static buddy_t *jclient_action_buddy;
|
static buddy_t *jclient_action_buddy;
|
||||||
|
@ -2469,12 +2470,14 @@ int JCL_ConExecuteCommand(qboolean isinsecure)
|
||||||
if (jclient_action_cl->status == JCL_INACTIVE)
|
if (jclient_action_cl->status == JCL_INACTIVE)
|
||||||
jclient_action_cl->status = JCL_DEAD;
|
jclient_action_cl->status = JCL_DEAD;
|
||||||
jclient_action = ACT_NONE;
|
jclient_action = ACT_NONE;
|
||||||
|
jclient_configdirty = true;
|
||||||
return 2; //ask to not store in history.
|
return 2; //ask to not store in history.
|
||||||
case ACT_ADDFRIEND:
|
case ACT_ADDFRIEND:
|
||||||
if (*args)
|
if (*args)
|
||||||
XMPP_AddFriend(jclient_action_cl, args, "");
|
XMPP_AddFriend(jclient_action_cl, args, "");
|
||||||
break;
|
break;
|
||||||
case ACT_SETBALIAS:
|
case ACT_SETBALIAS:
|
||||||
|
jclient_configdirty = true;
|
||||||
Q_strncpyz(jclient_action_buddy->name, args, sizeof(jclient_action_buddy->name));
|
Q_strncpyz(jclient_action_buddy->name, args, sizeof(jclient_action_buddy->name));
|
||||||
if (jclient_action_buddy->btype == BT_ROSTER)
|
if (jclient_action_buddy->btype == BT_ROSTER)
|
||||||
JCL_SendIQf(jclient_action_cl, NULL, "set", NULL, "<query xmlns='jabber:iq:roster'><item jid='%s' name='%s'></item></query>", jclient_action_buddy->accountdomain, jclient_action_buddy->name);
|
JCL_SendIQf(jclient_action_cl, NULL, "set", NULL, "<query xmlns='jabber:iq:roster'><item jid='%s' name='%s'></item></query>", jclient_action_buddy->accountdomain, jclient_action_buddy->name);
|
||||||
|
@ -3656,6 +3659,8 @@ static qboolean JCL_BuddyVCardReply(jclient_t *jcl, xmltree_t *tree, struct iq_s
|
||||||
bi->imagehash = strdup(hasha);
|
bi->imagehash = strdup(hasha);
|
||||||
bi->image = strdup(photobinval->body);
|
bi->image = strdup(photobinval->body);
|
||||||
bi->imagemime = strdup(photomime);
|
bi->imagemime = strdup(photomime);
|
||||||
|
|
||||||
|
jclient_configdirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5808,7 +5813,10 @@ void JCL_CloseConnection(jclient_t *jcl, const char *reason, qboolean reconnect)
|
||||||
for (i = 0; i < sizeof(jclients)/sizeof(jclients[0]); i++)
|
for (i = 0; i < sizeof(jclients)/sizeof(jclients[0]); i++)
|
||||||
{
|
{
|
||||||
if (jclients[i] == jcl)
|
if (jclients[i] == jcl)
|
||||||
|
{
|
||||||
jclients[i] = NULL;
|
jclients[i] = NULL;
|
||||||
|
jclient_configdirty = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6411,6 +6419,10 @@ void JCL_WriteConfig(void)
|
||||||
struct buddyinfo_s *bi;
|
struct buddyinfo_s *bi;
|
||||||
buddy_t *bud;
|
buddy_t *bud;
|
||||||
|
|
||||||
|
if (!jclient_configdirty)
|
||||||
|
return; //no point yet.
|
||||||
|
jclient_configdirty = false;
|
||||||
|
|
||||||
//don't write the config if we're meant to be reading it. avoid wiping it if we're killed fast.
|
//don't write the config if we're meant to be reading it. avoid wiping it if we're killed fast.
|
||||||
if (jclient_needreadconfig)
|
if (jclient_needreadconfig)
|
||||||
return;
|
return;
|
||||||
|
@ -6525,6 +6537,7 @@ void JCL_LoadConfig(void)
|
||||||
qhandle_t config;
|
qhandle_t config;
|
||||||
char *buf;
|
char *buf;
|
||||||
qboolean oldtls;
|
qboolean oldtls;
|
||||||
|
jclient_configdirty = false;
|
||||||
len = filefuncs->Open("**plugconfig", &config, 1);
|
len = filefuncs->Open("**plugconfig", &config, 1);
|
||||||
if (len >= 0)
|
if (len >= 0)
|
||||||
{
|
{
|
||||||
|
@ -6986,6 +6999,7 @@ void JCL_Command(int accid, char *console)
|
||||||
Con_TrySubPrint(console, "Connect failed\n");
|
Con_TrySubPrint(console, "Connect failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
jclient_configdirty = true;
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg[0]+1, "help"))
|
else if (!strcmp(arg[0]+1, "help"))
|
||||||
{
|
{
|
||||||
|
@ -7041,6 +7055,7 @@ void JCL_Command(int accid, char *console)
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg[0]+1, "oa2token"))
|
else if (!strcmp(arg[0]+1, "oa2token"))
|
||||||
{
|
{
|
||||||
|
jclient_configdirty = true;
|
||||||
free(jcl->sasl.oauth2.authtoken);
|
free(jcl->sasl.oauth2.authtoken);
|
||||||
jcl->sasl.oauth2.authtoken = strdup(arg[1]);
|
jcl->sasl.oauth2.authtoken = strdup(arg[1]);
|
||||||
if (jcl->status == JCL_INACTIVE)
|
if (jcl->status == JCL_INACTIVE)
|
||||||
|
@ -7048,6 +7063,7 @@ void JCL_Command(int accid, char *console)
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg[0]+1, "set"))
|
else if (!strcmp(arg[0]+1, "set"))
|
||||||
{
|
{
|
||||||
|
jclient_configdirty = true;
|
||||||
if (!strcmp(arg[1], "savepassword"))
|
if (!strcmp(arg[1], "savepassword"))
|
||||||
jcl->savepassword = atoi(arg[2]);
|
jcl->savepassword = atoi(arg[2]);
|
||||||
else if (!strcmp(arg[1], "avatars"))
|
else if (!strcmp(arg[1], "avatars"))
|
||||||
|
@ -7069,6 +7085,7 @@ void JCL_Command(int accid, char *console)
|
||||||
}
|
}
|
||||||
else if (!strcmp(arg[0]+1, "password"))
|
else if (!strcmp(arg[0]+1, "password"))
|
||||||
{
|
{
|
||||||
|
jclient_configdirty = true;
|
||||||
Q_strncpyz(jcl->sasl.password_plain, arg[1], sizeof(jcl->sasl.password_plain));
|
Q_strncpyz(jcl->sasl.password_plain, arg[1], sizeof(jcl->sasl.password_plain));
|
||||||
jcl->sasl.password_hash_size = 0;
|
jcl->sasl.password_hash_size = 0;
|
||||||
if (jcl->status == JCL_INACTIVE)
|
if (jcl->status == JCL_INACTIVE)
|
||||||
|
|
Loading…
Reference in a new issue