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 strcpy(ident,"");
00017 strcpy(host,"");
00018 strcpy(dhost,"");
00019 strcpy(fullname,"");
00020 strcpy(modes,"");
00021 strcpy(inbuf,"");
00022 strcpy(server,"");
00023 strcpy(awaymsg,"");
00024 fd = lastping = signon = idle_lastmsg = nping = registered = 0;
00025 port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
00026 haspassed = false;
00027 strcpy(result,"");
00028 for (int i = 0; i < MAXCHANS; i++)
00029 {
00030 chans[i].channel = NULL;
00031 }
00032 invites.clear();
00033 }
00034
00035
00036 char* userrec::GetFullHost()
00037 {
00038 sprintf(result,"%s!%s@%s",nick,ident,dhost);
00039 return result;
00040 }
00041
00042
00043 char* userrec::GetFullRealHost()
00044 {
00045 sprintf(result,"%s!%s@%s",nick,ident,host);
00046 return result;
00047 }
00048
00049 bool userrec::IsInvited(char* channel)
00050 {
00051 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00052 {
00053 if (!strcasecmp(i->channel,channel))
00054 {
00055 return true;
00056 }
00057 }
00058 }
00059
00060 void userrec::InviteTo(char* channel)
00061 {
00062 Invited i;
00063 strcpy(i.channel,channel);
00064 invites.push_back(i);
00065 }
00066
00067 void userrec::RemoveInvite(char* channel)
00068 {
00069 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00070 {
00071 if (!strcasecmp(i->channel,channel))
00072 {
00073 invites.erase(i);
00074 return;
00075 }
00076 }
00077 }