diff -Naur ser-0.8.10/modules/registrar/save.c ser-0.8.10.new/modules/registrar/save.c --- ser-0.8.10/modules/registrar/save.c 2002-11-12 00:11:52.000000000 +0100 +++ ser-0.8.10.new/modules/registrar/save.c 2003-03-11 11:22:54.000000000 +0100 @@ -43,6 +43,40 @@ #include "regtime.h" +void remove_cont(urecord_t* _r, ucontact_t* _c) +{ + if (_c->prev) { + _c->prev->next = _c->next; + if (_c->next) { + _c->next->prev = _c->prev; + } + } else { + _r->contacts = _c->next; + if (_c->next) { + _c->next->prev = 0; + } + } +} + + +void move_on_top(urecord_t* _r, ucontact_t* _c) +{ + ucontact_t* prev; + + if (!_r->contacts) return; + if (_c->prev == 0) return; + + prev = _c->prev; + + remove_cont(_r, _c); + + _c->next = _r->contacts; + _c->prev = 0; + + _r->contacts->prev = _c; + _r->contacts = _c; +} + /* * Process request that contained a star, in that case, * we will remove all bindings with the given username @@ -261,6 +295,9 @@ LOG(L_ERR, "update(): Error while updating contact\n"); return -8; } + + move_on_top(_r, c); + } } _c = get_next_contact(_c); diff -Naur ser-0.8.10/modules/usrloc/urecord.c ser-0.8.10.new/modules/usrloc/urecord.c --- ser-0.8.10/modules/usrloc/urecord.c 2002-09-19 14:23:55.000000000 +0200 +++ ser-0.8.10.new/modules/usrloc/urecord.c 2003-03-11 11:20:28.000000000 +0100 @@ -125,11 +125,13 @@ ptr = _r->contacts; + /* while(ptr) { if (ptr->q < _q) break; prev = ptr; ptr = ptr->next; } + */ if (ptr) { if (!ptr->prev) {