Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

users.cpp

Go to the documentation of this file.
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         // the PROPER way to do it, AVOID bzero at *ALL* costs
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 (i->channel) {
00054                         if (!strcasecmp(i->channel,channel))
00055                         {
00056                                 return true;
00057                         }
00058                 }
00059         }
00060         return false;
00061 }
00062 
00063 void userrec::InviteTo(char* channel)
00064 {
00065         Invited i;
00066         strcpy(i.channel,channel);
00067         invites.push_back(i);
00068 }
00069 
00070 void userrec::RemoveInvite(char* channel)
00071 {
00072         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00073         {
00074                 if (i->channel) {
00075                         if (!strcasecmp(i->channel,channel))
00076                         {
00077                                 invites.erase(i);
00078                                 return;
00079                         }
00080                 }
00081         }
00082 }

Generated on Fri Apr 2 13:37:27 2004 for InspIRCd by doxygen1.3-rc3