[ekg2-commit] ekg2: jabber_handlers.c (HEAD) [peres]
CVS commit
cvs w toxygen.net
Pią, 26 Paź 2007, 00:00:06 CEST
Module name: ekg2
Changes by: peres 2007-10-26 00:00:04
Modified files:
jabber_handlers.c
Log message:
Fix nickname generation - as we resort the list now, we must restart
checking from beginning after each change. Of course, we could first
update all the data, and then resort - but that would need the use
of another list, and blah blah.
Index: jabber_handlers.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_handlers.c,v
diff -d -u -r1.131 -r1.132
--- jabber_handlers.c 23 Oct 2007 13:02:13 -0000 1.131
+++ jabber_handlers.c 25 Oct 2007 22:00:04 -0000 1.132
@@ -2584,7 +2584,7 @@
{ /* nickname generator */
list_t l;
- for (l = s->userlist; l; l = l->next) {
+ for (l = s->userlist; l;) {
userlist_t *u = l->data;
if (u && !u->nickname) {
@@ -2621,12 +2621,20 @@
if (*cp) {
u->nickname = xstrdup(*cp);
userlist_replace(s, u); /* resort */
+
+ /* sorting changes order,
+ * so we need to start from beginning
+ * sorry */
+ l = s->userlist;
+ continue;
} else
debug_error("[jabber] can't find any free nickname for UID %s.. that's kinda bitch!\n", u->uid);
xfree(userpart);
xfree(myuid);
}
+
+ l = l->next;
}
}
Więcej informacji o liście dyskusyjnej ekg2-commit