* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UserNode.h"
+#include "ChanNode.h"
#include "ChanUser.h"
#include "tools.h"
#include "IRCEvents.h"
user->flags = 0;
user->channel = NULL;
user->last_who = 0;
+ SYNCHRONIZE(cache_sync);
user->next = userList[userListIndex];
userList[userListIndex] = user;
+ DESYNCHRONIZE(cache_sync);
return user;
}
user->flags &= ~USERFLAG_ISAUTHED; //remove authed flag (security reasons)
strcpy(user->nick, nick);
if(!already_on_list) {
+ SYNCHRONIZE(cache_sync);
user->next = userList[TEMPUSER_LIST_INDEX];
userList[TEMPUSER_LIST_INDEX] = user;
+ DESYNCHRONIZE(cache_sync);
}
return user;
}
}
}
if(!already_on_list) {
+ SYNCHRONIZE(cache_sync);
user->next = userList[TEMPUSER_LIST_INDEX];
userList[TEMPUSER_LIST_INDEX] = user;
+ DESYNCHRONIZE(cache_sync);
}
return user;
}
}
//delUser(user, 0); //EPIC FAIL! This deletes the user from the channel Userlist -.-
//manually remove the user from the old userList
+ SYNCHRONIZE(cache_sync);
int userListIndex = get_nicklist_entry(user->nick[0]);
if(userListIndex != -1) {
struct UserNode *cuser, *last_user = NULL;
strcpy(user->nick, new_nick);
user->next = userList[userListIndex];
userList[userListIndex] = user;
+ DESYNCHRONIZE(cache_sync);
return 1;
}
void delUser(struct UserNode* user, int freeUser) {
int userListIndex = ((user->flags & USERFLAG_ISTMPUSER) ? TEMPUSER_LIST_INDEX : get_nicklist_entry(user->nick[0]));
if(userListIndex == -1) return;
+ SYNCHRONIZE(cache_sync);
event_freeuser(user);
struct UserNode *cuser, *last_user = NULL;
for(cuser = userList[userListIndex]; cuser; cuser = cuser->next) {
free(user);
} else
user->next = NULL;
+ DESYNCHRONIZE(cache_sync);
}
void clearTempUsers() {
+ SYNCHRONIZE(cache_sync);
int userListIndex = TEMPUSER_LIST_INDEX;
struct UserNode *cuser, *next;
time_t now = time(0);
delUser(cuser, 1);
}
}
+ DESYNCHRONIZE(cache_sync);
}