Main Page   Namespace List   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         log(DEBUG,"Removing invites");
00073         if (invites.size())
00074         {
00075                 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00076                 {
00077                         if (i->channel) {
00078                                 if (!strcasecmp(i->channel,channel))
00079                                 {
00080                                         invites.erase(i);
00081                                         return;
00082                                 }
00083                         }
00084                 }
00085         }
00086 }

Generated on Sun Apr 4 23:02:14 2004 for InspIRCd by doxygen1.3-rc3