00001
00002
00003
00004
00005 #include "inspircd_config.h"
00006 #include "channels.h"
00007 #include "users.h"
00008 #include "inspircd.h"
00009 #include <stdio.h>
00010
00011 userrec::userrec()
00012 {
00013
00014 strcpy(nick,"");
00015 ip = 0;
00016 timeout = 0;
00017 strcpy(ident,"");
00018 strcpy(host,"");
00019 strcpy(dhost,"");
00020 strcpy(fullname,"");
00021 strcpy(modes,"");
00022 strcpy(inbuf,"");
00023 strcpy(server,"");
00024 strcpy(awaymsg,"");
00025 fd = lastping = signon = idle_lastmsg = nping = registered = 0;
00026 port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
00027 haspassed = false;
00028 strcpy(result,"");
00029 for (int i = 0; i < MAXCHANS; i++)
00030 {
00031 chans[i].channel = NULL;
00032 }
00033 invites.clear();
00034 }
00035
00036
00037
00038 char* userrec::GetFullHost()
00039 {
00040 sprintf(result,"%s!%s@%s",nick,ident,dhost);
00041 return result;
00042 }
00043
00044
00045 char* userrec::GetFullRealHost()
00046 {
00047 sprintf(result,"%s!%s@%s",nick,ident,host);
00048 return result;
00049 }
00050
00051 bool userrec::IsInvited(char* channel)
00052 {
00053 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00054 {
00055 if (i->channel) {
00056 if (!strcasecmp(i->channel,channel))
00057 {
00058 return true;
00059 }
00060 }
00061 }
00062 return false;
00063 }
00064
00065 void userrec::InviteTo(char* channel)
00066 {
00067 Invited i;
00068 strcpy(i.channel,channel);
00069 invites.push_back(i);
00070 }
00071
00072 void userrec::RemoveInvite(char* channel)
00073 {
00074 log(DEBUG,"Removing invites");
00075 if (invites.size())
00076 {
00077 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00078 {
00079 if (i->channel) {
00080 if (!strcasecmp(i->channel,channel))
00081 {
00082 invites.erase(i);
00083 return;
00084 }
00085 }
00086 }
00087 }
00088 }