summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp32
-rw-r--r--src/cmd_admin.cpp8
-rw-r--r--src/cmd_away.cpp4
-rw-r--r--src/cmd_commands.cpp4
-rw-r--r--src/cmd_connect.cpp2
-rw-r--r--src/cmd_die.cpp2
-rw-r--r--src/cmd_eline.cpp2
-rw-r--r--src/cmd_gline.cpp2
-rw-r--r--src/cmd_info.cpp84
-rw-r--r--src/cmd_invite.cpp18
-rw-r--r--src/cmd_ison.cpp2
-rw-r--r--src/cmd_join.cpp2
-rw-r--r--src/cmd_kick.cpp4
-rw-r--r--src/cmd_kill.cpp4
-rw-r--r--src/cmd_kline.cpp2
-rw-r--r--src/cmd_links.cpp4
-rw-r--r--src/cmd_list.cpp6
-rw-r--r--src/cmd_loadmodule.cpp4
-rw-r--r--src/cmd_lusers.cpp10
-rw-r--r--src/cmd_map.cpp4
-rw-r--r--src/cmd_modules.cpp14
-rw-r--r--src/cmd_names.cpp8
-rw-r--r--src/cmd_nick.cpp6
-rw-r--r--src/cmd_notice.cpp12
-rw-r--r--src/cmd_oper.cpp8
-rw-r--r--src/cmd_part.cpp2
-rw-r--r--src/cmd_pass.cpp2
-rw-r--r--src/cmd_ping.cpp2
-rw-r--r--src/cmd_privmsg.cpp14
-rw-r--r--src/cmd_qline.cpp2
-rw-r--r--src/cmd_quit.cpp4
-rw-r--r--src/cmd_rehash.cpp2
-rw-r--r--src/cmd_server.cpp2
-rw-r--r--src/cmd_squit.cpp2
-rw-r--r--src/cmd_stats.cpp2
-rw-r--r--src/cmd_summon.cpp2
-rw-r--r--src/cmd_time.cpp2
-rw-r--r--src/cmd_topic.cpp16
-rw-r--r--src/cmd_trace.cpp6
-rw-r--r--src/cmd_unloadmodule.cpp4
-rw-r--r--src/cmd_user.cpp4
-rw-r--r--src/cmd_userhost.cpp2
-rw-r--r--src/cmd_users.cpp2
-rw-r--r--src/cmd_version.cpp4
-rw-r--r--src/cmd_who.cpp6
-rw-r--r--src/cmd_whois.cpp28
-rw-r--r--src/cmd_whowas.cpp14
-rw-r--r--src/cmd_zline.cpp4
-rw-r--r--src/command_parse.cpp14
-rw-r--r--src/commands.cpp4
-rw-r--r--src/configreader.cpp20
-rw-r--r--src/helperfuncs.cpp334
-rw-r--r--src/message.cpp2
-rw-r--r--src/mode.cpp22
-rw-r--r--src/modes/cmode_b.cpp6
-rw-r--r--src/modes/cmode_h.cpp5
-rw-r--r--src/modes/cmode_o.cpp4
-rw-r--r--src/modes/cmode_v.cpp4
-rw-r--r--src/modules.cpp49
-rw-r--r--src/modules/extra/m_filter_pcre.cpp2
-rw-r--r--src/modules/extra/m_sqloper.cpp6
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp2
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp2
-rw-r--r--src/modules/m_alias.cpp4
-rw-r--r--src/modules/m_antibear.cpp4
-rw-r--r--src/modules/m_blockamsg.cpp2
-rw-r--r--src/modules/m_blockcaps.cpp2
-rw-r--r--src/modules/m_blockcolor.cpp2
-rw-r--r--src/modules/m_botmode.cpp2
-rw-r--r--src/modules/m_cban.cpp10
-rw-r--r--src/modules/m_chanfilter.cpp10
-rw-r--r--src/modules/m_chanprotect.cpp30
-rw-r--r--src/modules/m_check.cpp40
-rw-r--r--src/modules/m_chghost.cpp4
-rw-r--r--src/modules/m_chgident.cpp4
-rw-r--r--src/modules/m_conn_waitpong.cpp4
-rw-r--r--src/modules/m_denychans.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_globalload.cpp8
-rw-r--r--src/modules/m_helpop.cpp8
-rw-r--r--src/modules/m_hostchange.cpp2
-rw-r--r--src/modules/m_ident.cpp8
-rw-r--r--src/modules/m_joinflood.cpp6
-rw-r--r--src/modules/m_kicknorejoin.cpp2
-rw-r--r--src/modules/m_knock.cpp8
-rw-r--r--src/modules/m_messageflood.cpp4
-rw-r--r--src/modules/m_nicklock.cpp6
-rw-r--r--src/modules/m_noctcp.cpp2
-rw-r--r--src/modules/m_noinvite.cpp2
-rw-r--r--src/modules/m_nokicks.cpp2
-rw-r--r--src/modules/m_nonicks.cpp2
-rw-r--r--src/modules/m_nonotice.cpp2
-rw-r--r--src/modules/m_operchans.cpp2
-rw-r--r--src/modules/m_operlevels.cpp4
-rw-r--r--src/modules/m_opermd5.cpp2
-rw-r--r--src/modules/m_opermotd.cpp8
-rw-r--r--src/modules/m_opersha256.cpp2
-rw-r--r--src/modules/m_park.cpp24
-rw-r--r--src/modules/m_randquote.cpp4
-rw-r--r--src/modules/m_redirect.cpp8
-rw-r--r--src/modules/m_remove.cpp10
-rw-r--r--src/modules/m_restrictchans.cpp2
-rw-r--r--src/modules/m_restrictmsg.cpp2
-rw-r--r--src/modules/m_safelist.cpp8
-rw-r--r--src/modules/m_sajoin.cpp4
-rw-r--r--src/modules/m_sanick.cpp2
-rw-r--r--src/modules/m_sapart.cpp2
-rw-r--r--src/modules/m_saquit.cpp2
-rw-r--r--src/modules/m_securelist.cpp6
-rw-r--r--src/modules/m_services.cpp12
-rw-r--r--src/modules/m_services_account.cpp8
-rw-r--r--src/modules/m_sethost.cpp4
-rw-r--r--src/modules/m_setident.cpp2
-rw-r--r--src/modules/m_setidle.cpp4
-rw-r--r--src/modules/m_showwhois.cpp2
-rw-r--r--src/modules/m_silence.cpp10
-rw-r--r--src/modules/m_spanningtree.cpp60
-rw-r--r--src/modules/m_spy.cpp16
-rw-r--r--src/modules/m_ssl_dummy.cpp2
-rw-r--r--src/modules/m_sslmodes.cpp4
-rw-r--r--src/modules/m_swhois.cpp2
-rw-r--r--src/modules/m_timedbans.cpp10
-rw-r--r--src/modules/m_tline.cpp4
-rw-r--r--src/modules/m_uninvite.cpp14
-rw-r--r--src/modules/m_userip.cpp2
-rw-r--r--src/modules/m_vhost.cpp4
-rw-r--r--src/modules/m_watch.cpp28
-rw-r--r--src/userprocess.cpp4
-rw-r--r--src/users.cpp150
129 files changed, 638 insertions, 832 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 5fcf63148..559b6d3f7 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -286,7 +286,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
if (!key)
{
log(DEBUG,"chanrec::JoinUser(): no key given in JOIN");
- WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
+ user->WriteServ("475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
return NULL;
}
else
@@ -294,7 +294,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
if (strcmp(key,Ptr->key))
{
log(DEBUG,"chanrec::JoinUser(): bad key given in JOIN");
- WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
+ user->WriteServ("475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
return NULL;
}
}
@@ -314,7 +314,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
}
else
{
- WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name);
+ user->WriteServ("473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name);
return NULL;
}
}
@@ -328,7 +328,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
{
if (usercount(Ptr) >= Ptr->limit)
{
- WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name);
+ user->WriteServ("471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name);
return NULL;
}
}
@@ -349,7 +349,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
*/
if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true)))
{
- WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
+ user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
return NULL;
}
}
@@ -396,7 +396,7 @@ chanrec* chanrec::JoinUser(userrec *user, const char* cn, bool override, const c
}
}
- WriteServ(user->fd,"405 %s %s :You are on too many channels",user->nick, cname);
+ user->WriteServ("405 %s %s :You are on too many channels",user->nick, cname);
if (created == 2)
{
@@ -455,11 +455,11 @@ chanrec* chanrec::ForceChan(chanrec* Ptr,ucrec *a,userrec* user, int created)
log(DEBUG,"Sent JOIN to client");
if (Ptr->topicset)
{
- WriteServ(user->fd,"332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
- WriteServ(user->fd,"333 %s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
+ user->WriteServ("332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
+ user->WriteServ("333 %s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset);
}
userlist(user,Ptr);
- WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
+ user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, Ptr->name);
}
FOREACH_MOD(I_OnUserJoin,OnUserJoin(user,Ptr));
return Ptr;
@@ -565,12 +565,12 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
{
if (!this->HasUser(user))
{
- WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, this->name);
+ src->WriteServ("441 %s %s %s :They are not on that channel",src->nick, user->nick, this->name);
return this->GetUserCounter();
}
if ((is_uline(user->server)) && (!is_uline(src->server)))
{
- WriteServ(src->fd,"482 %s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name);
+ src->WriteServ("482 %s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name);
return this->GetUserCounter();
}
int MOD_RESULT = 0;
@@ -597,11 +597,11 @@ long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
{
if (them == STATUS_HOP)
{
- WriteServ(src->fd,"482 %s %s :You must be a channel operator",src->nick, this->name);
+ src->WriteServ("482 %s %s :You must be a channel operator",src->nick, this->name);
}
else
{
- WriteServ(src->fd,"482 %s %s :You must be at least a half-operator",src->nick, this->name);
+ src->WriteServ("482 %s %s :You must be at least a half-operator",src->nick, this->name);
}
return this->GetUserCounter();
}
@@ -665,7 +665,7 @@ void chanrec::WriteChannel(userrec* user, const std::string &text)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
if (i->second->fd != FD_MAGIC_NUMBER)
- WriteTo_NoFormat(user,i->second,text.c_str());
+ user->WriteTo(i->second,text);
}
}
@@ -691,7 +691,7 @@ void chanrec::WriteChannelWithServ(const char* ServName, const std::string &text
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
if (IS_LOCAL(i->second))
- WriteServ_NoFormat(i->second->fd,text.c_str());
+ i->second->WriteServ(text);
}
}
@@ -738,7 +738,7 @@ void chanrec::WriteAllExceptSender(userrec* user, char status, const std::string
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
if ((IS_LOCAL(i->second)) && (user != i->second))
- WriteFrom_NoFormat(i->second->fd,user,text.c_str());
+ i->second->WriteFrom(user,text);
}
}
diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp
index 48b237e64..56cb3a4b1 100644
--- a/src/cmd_admin.cpp
+++ b/src/cmd_admin.cpp
@@ -24,8 +24,8 @@ extern ServerConfig* Config;
void cmd_admin::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"256 %s :Administrative info for %s",user->nick,Config->ServerName);
- WriteServ(user->fd,"257 %s :Name - %s",user->nick,Config->AdminName);
- WriteServ(user->fd,"258 %s :Nickname - %s",user->nick,Config->AdminNick);
- WriteServ(user->fd,"258 %s :E-Mail - %s",user->nick,Config->AdminEmail);
+ user->WriteServ("256 %s :Administrative info for %s",user->nick,Config->ServerName);
+ user->WriteServ("257 %s :Name - %s",user->nick,Config->AdminName);
+ user->WriteServ("258 %s :Nickname - %s",user->nick,Config->AdminNick);
+ user->WriteServ("258 %s :E-Mail - %s",user->nick,Config->AdminEmail);
}
diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp
index 86e5559f3..627feefc0 100644
--- a/src/cmd_away.cpp
+++ b/src/cmd_away.cpp
@@ -35,13 +35,13 @@ void cmd_away::Handle (const char** parameters, int pcnt, userrec *user)
if (pcnt)
{
strlcpy(user->awaymsg,parameters[0],MAXAWAY);
- WriteServ(user->fd,"306 %s :You have been marked as being away",user->nick);
+ user->WriteServ("306 %s :You have been marked as being away",user->nick);
FOREACH_MOD(I_OnSetAway,OnSetAway(user));
}
else
{
*user->awaymsg = 0;
- WriteServ(user->fd,"305 %s :You are no longer marked as being away",user->nick);
+ user->WriteServ("305 %s :You are no longer marked as being away",user->nick);
FOREACH_MOD(I_OnCancelAway,OnCancelAway(user));
}
}
diff --git a/src/cmd_commands.cpp b/src/cmd_commands.cpp
index 257413c11..dfcc874c9 100644
--- a/src/cmd_commands.cpp
+++ b/src/cmd_commands.cpp
@@ -26,7 +26,7 @@ void cmd_commands::Handle (const char** parameters, int pcnt, userrec *user)
{
for (nspace::hash_map<std::string,command_t*>::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
{
- WriteServ(user->fd,"902 %s :%s %s %d",user->nick,i->second->command.c_str(),i->second->source.c_str(),i->second->min_params);
+ user->WriteServ("902 %s :%s %s %d",user->nick,i->second->command.c_str(),i->second->source.c_str(),i->second->min_params);
}
- WriteServ(user->fd,"903 %s :End of COMMANDS list",user->nick);
+ user->WriteServ("903 %s :End of COMMANDS list",user->nick);
}
diff --git a/src/cmd_connect.cpp b/src/cmd_connect.cpp
index affeb9317..8f96e7b55 100644
--- a/src/cmd_connect.cpp
+++ b/src/cmd_connect.cpp
@@ -24,5 +24,5 @@
*/
void cmd_connect::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd, "NOTICE %s :You are a nub. Load a linking module.", user->nick);
+ user->WriteServ( "NOTICE %s :You are a nub. Load a linking module.", user->nick);
}
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index 3e3d63f3e..27a88fddb 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -42,7 +42,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
if (IS_LOCAL(a) && (a->modes[UM_SERVERNOTICE]))
{
- WriteServ(a->fd, "NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host);
+ a->WriteServ("NOTICE %s :*** DIE command from %s!%s@%s, terminating...", a->nick, a->nick, a->ident, a->host);
a->FlushWriteBuf();
}
}
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index 70d07236a..42fb78363 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -57,7 +57,7 @@ void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** E-Line %s not found in list, try /stats e.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** E-Line %s not found in list, try /stats e.",user->nick,parameters[0]);
}
}
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 201683541..35bd176b2 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -59,7 +59,7 @@ void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** G-Line %s not found in list, try /stats g.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** G-Line %s not found in list, try /stats g.",user->nick,parameters[0]);
}
}
}
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index d33b678a4..51becbef5 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -28,47 +28,47 @@ extern std::vector<ircd_module*> factory;
void cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd, "371 %s :. o O (The Inspire Internet Relay Chat Server) O o .", user->nick);
- WriteServ(user->fd, "371 %s : ", user->nick);
- WriteServ(user->fd, "371 %s :Core Developers:", user->nick);
- WriteServ(user->fd, "371 %s : Craig Edwards (Brain)", user->nick);
- WriteServ(user->fd, "371 %s : Craig McLure", user->nick);
- WriteServ(user->fd, "371 %s : w00t", user->nick);
- WriteServ(user->fd, "371 %s : Om", user->nick);
- WriteServ(user->fd, "371 %s : Special", user->nick);
- WriteServ(user->fd, "371 %s : ", user->nick);
- WriteServ(user->fd, "371 %s :Contributors:", user->nick);
- WriteServ(user->fd, "371 %s : typobox43", user->nick);
- WriteServ(user->fd, "371 %s : Jazza", user->nick);
- WriteServ(user->fd, "371 %s : pippijn", user->nick);
- WriteServ(user->fd, "371 %s : ", user->nick);
- WriteServ(user->fd, "371 %s :Testers:", user->nick);
- WriteServ(user->fd, "371 %s : CC", user->nick);
- WriteServ(user->fd, "371 %s : Piggles", user->nick);
- WriteServ(user->fd, "371 %s : Foamy", user->nick);
- WriteServ(user->fd, "371 %s : Hart", user->nick);
- WriteServ(user->fd, "371 %s : RageD", user->nick);
- WriteServ(user->fd, "371 %s : [ed]", user->nick);
- WriteServ(user->fd, "371 %s : Azhrarn", user->nick);
- WriteServ(user->fd, "371 %s : nenolod", user->nick);
- WriteServ(user->fd, "371 %s : luigiman", user->nick);
- WriteServ(user->fd, "371 %s : Chu", user->nick);
- WriteServ(user->fd, "371 %s : aquanight", user->nick);
- WriteServ(user->fd, "371 %s : xptek", user->nick);
- WriteServ(user->fd, "371 %s : Grantlinks", user->nick);
- WriteServ(user->fd, "371 %s : Rob", user->nick);
- WriteServ(user->fd, "371 %s : angelic", user->nick);
- WriteServ(user->fd, "371 %s : Jason", user->nick);
- WriteServ(user->fd, "371 %s : ThaPrince", user->nick);
- WriteServ(user->fd, "371 %s : eggy", user->nick);
- WriteServ(user->fd, "371 %s : skenmy", user->nick);
- WriteServ(user->fd, "371 %s : ", user->nick);
- WriteServ(user->fd, "371 %s :Thanks to irc-junkie and searchirc", user->nick);
- WriteServ(user->fd, "371 %s :for the nice comments and the help", user->nick);
- WriteServ(user->fd, "371 %s :you gave us in attracting users to", user->nick);
- WriteServ(user->fd, "371 %s :this software.", user->nick);
- WriteServ(user->fd, "371 %s : ", user->nick);
- WriteServ(user->fd, "371 %s :Best experienced with: An IRC client.", user->nick);
+ user->WriteServ( "371 %s :. o O (The Inspire Internet Relay Chat Server) O o .", user->nick);
+ user->WriteServ( "371 %s : ", user->nick);
+ user->WriteServ( "371 %s :Core Developers:", user->nick);
+ user->WriteServ( "371 %s : Craig Edwards (Brain)", user->nick);
+ user->WriteServ( "371 %s : Craig McLure", user->nick);
+ user->WriteServ( "371 %s : w00t", user->nick);
+ user->WriteServ( "371 %s : Om", user->nick);
+ user->WriteServ( "371 %s : Special", user->nick);
+ user->WriteServ( "371 %s : ", user->nick);
+ user->WriteServ( "371 %s :Contributors:", user->nick);
+ user->WriteServ( "371 %s : typobox43", user->nick);
+ user->WriteServ( "371 %s : Jazza", user->nick);
+ user->WriteServ( "371 %s : pippijn", user->nick);
+ user->WriteServ( "371 %s : ", user->nick);
+ user->WriteServ( "371 %s :Testers:", user->nick);
+ user->WriteServ( "371 %s : CC", user->nick);
+ user->WriteServ( "371 %s : Piggles", user->nick);
+ user->WriteServ( "371 %s : Foamy", user->nick);
+ user->WriteServ( "371 %s : Hart", user->nick);
+ user->WriteServ( "371 %s : RageD", user->nick);
+ user->WriteServ( "371 %s : [ed]", user->nick);
+ user->WriteServ( "371 %s : Azhrarn", user->nick);
+ user->WriteServ( "371 %s : nenolod", user->nick);
+ user->WriteServ( "371 %s : luigiman", user->nick);
+ user->WriteServ( "371 %s : Chu", user->nick);
+ user->WriteServ( "371 %s : aquanight", user->nick);
+ user->WriteServ( "371 %s : xptek", user->nick);
+ user->WriteServ( "371 %s : Grantlinks", user->nick);
+ user->WriteServ( "371 %s : Rob", user->nick);
+ user->WriteServ( "371 %s : angelic", user->nick);
+ user->WriteServ( "371 %s : Jason", user->nick);
+ user->WriteServ( "371 %s : ThaPrince", user->nick);
+ user->WriteServ( "371 %s : eggy", user->nick);
+ user->WriteServ( "371 %s : skenmy", user->nick);
+ user->WriteServ( "371 %s : ", user->nick);
+ user->WriteServ( "371 %s :Thanks to irc-junkie and searchirc", user->nick);
+ user->WriteServ( "371 %s :for the nice comments and the help", user->nick);
+ user->WriteServ( "371 %s :you gave us in attracting users to", user->nick);
+ user->WriteServ( "371 %s :this software.", user->nick);
+ user->WriteServ( "371 %s : ", user->nick);
+ user->WriteServ( "371 %s :Best experienced with: An IRC client.", user->nick);
FOREACH_MOD(I_OnInfo,OnInfo(user));
- WriteServ(user->fd, "374 %s :End of /INFO list", user->nick);
+ user->WriteServ( "374 %s :End of /INFO list", user->nick);
}
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index f452f215b..94ed1d1f3 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -41,11 +41,11 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
{
if (!c)
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[1]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]);
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
return;
@@ -55,20 +55,20 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
{
if (cstatus(user,c) < STATUS_HOP)
{
- WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
+ user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
return;
}
}
if (c->HasUser(u))
{
- WriteServ(user->fd,"443 %s %s %s :Is already on channel %s",user->nick,u->nick,c->name,c->name);
+ user->WriteServ("443 %s %s %s :Is already on channel %s",user->nick,u->nick,c->name,c->name);
return;
}
if ((IS_LOCAL(user)) && (!c->HasUser(user)))
{
- WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, c->name);
+ user->WriteServ("442 %s %s :You're not on that channel!",user->nick, c->name);
return;
}
@@ -81,8 +81,8 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
irc::string xname(c->name);
u->InviteTo(xname);
- WriteFrom(u->fd,user,"INVITE %s :%s",u->nick,c->name);
- WriteServ(user->fd,"341 %s %s %s",user->nick,u->nick,c->name);
+ u->WriteFrom(user,"INVITE %s :%s",u->nick,c->name);
+ user->WriteServ("341 %s %s %s",user->nick,u->nick,c->name);
FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c));
}
else
@@ -92,8 +92,8 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
InvitedList* il = user->GetInviteList();
for (InvitedList::iterator i = il->begin(); i != il->end(); i++)
{
- WriteServ(user->fd,"346 %s :%s",user->nick,i->channel.c_str());
+ user->WriteServ("346 %s :%s",user->nick,i->channel.c_str());
}
- WriteServ(user->fd,"347 %s :End of INVITE list",user->nick);
+ user->WriteServ("347 %s :End of INVITE list",user->nick);
}
}
diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp
index 099d6acd6..0b0ec24a5 100644
--- a/src/cmd_ison.cpp
+++ b/src/cmd_ison.cpp
@@ -39,5 +39,5 @@ void cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
}
}
- WriteServ(user->fd, retbuf);
+ user->WriteServ( retbuf);
}
diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp
index 4af887585..bf60e6543 100644
--- a/src/cmd_join.cpp
+++ b/src/cmd_join.cpp
@@ -47,5 +47,5 @@ void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
}
}
- WriteServ(user->fd,"403 %s %s :Invalid channel name",user->nick, parameters[0]);
+ user->WriteServ("403 %s %s :Invalid channel name",user->nick, parameters[0]);
}
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index 1da6d356f..042c6c02d 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -28,13 +28,13 @@ void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
if (!u || !c)
{
- WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
+ user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
return;
}
if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!is_uline(user->server)))
{
- WriteServ(user->fd, "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
+ user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
return;
}
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index ad602c097..f2728e72e 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -76,7 +76,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
{
// local kill
log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
- WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
+ user->WriteTo(u, "KILL %s :%s!%s!%s (%s)", u->nick, Config->ServerName, user->dhost, user->nick, parameters[1]);
WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]);
userrec::QuitUser(u, killreason);
@@ -84,6 +84,6 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, parameters[0]);
+ user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);
}
}
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index 89f051f5e..d5743c4e6 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -67,7 +67,7 @@ void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** K-Line %s not found in list, try /stats k.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** K-Line %s not found in list, try /stats k.",user->nick,parameters[0]);
}
}
}
diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp
index 57df3b4fb..633318a14 100644
--- a/src/cmd_links.cpp
+++ b/src/cmd_links.cpp
@@ -26,6 +26,6 @@ extern ServerConfig* Config;
void cmd_links::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"364 %s %s %s :0 %s",user->nick,Config->ServerName,Config->ServerName,Config->ServerDesc);
- WriteServ(user->fd,"365 %s * :End of /LINKS list.",user->nick);
+ user->WriteServ("364 %s %s %s :0 %s",user->nick,Config->ServerName,Config->ServerName,Config->ServerDesc);
+ user->WriteServ("365 %s * :End of /LINKS list.",user->nick);
}
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index 9d1a96fc9..f08e56d20 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -24,7 +24,7 @@ extern chan_hash chanlist;
void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"321 %s Channel :Users Name",user->nick);
+ user->WriteServ("321 %s Channel :Users Name",user->nick);
for (chan_hash::const_iterator i = chanlist.begin(); i != chanlist.end(); i++)
{
// if the channel is not private/secret, OR the user is on the channel anyway
@@ -33,8 +33,8 @@ void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
{
long users = usercount(i->second);
if (users)
- WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,chanmodes(i->second,n),i->second->topic);
+ user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,chanmodes(i->second,n),i->second->topic);
}
}
- WriteServ(user->fd,"323 %s :End of channel list.",user->nick);
+ user->WriteServ("323 %s :End of channel list.",user->nick);
}
diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp
index 5b91746ab..ace2debf7 100644
--- a/src/cmd_loadmodule.cpp
+++ b/src/cmd_loadmodule.cpp
@@ -27,10 +27,10 @@ void cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->LoadModule(parameters[0]))
{
WriteOpers("*** NEW MODULE: %s",parameters[0]);
- WriteServ(user->fd,"975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
+ user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
}
else
{
- WriteServ(user->fd,"974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
}
}
diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp
index fb28adc46..9c35bf35a 100644
--- a/src/cmd_lusers.cpp
+++ b/src/cmd_lusers.cpp
@@ -23,13 +23,13 @@ void cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user)
{
// this lusers command shows one server at all times because
// a protocol module must override it to show those stats.
- WriteServ(user->fd,"251 %s :There are %d users and %d invisible on 1 server",user->nick,usercnt()-usercount_invisible(),usercount_invisible());
+ user->WriteServ("251 %s :There are %d users and %d invisible on 1 server",user->nick,usercnt()-usercount_invisible(),usercount_invisible());
if (usercount_opers())
- WriteServ(user->fd,"252 %s %d :operator(s) online",user->nick,usercount_opers());
+ user->WriteServ("252 %s %d :operator(s) online",user->nick,usercount_opers());
if (usercount_unknown())
- WriteServ(user->fd,"253 %s %d :unknown connections",user->nick,usercount_unknown());
+ user->WriteServ("253 %s %d :unknown connections",user->nick,usercount_unknown());
if (chancount())
- WriteServ(user->fd,"254 %s %d :channels formed",user->nick,chancount());
+ user->WriteServ("254 %s %d :channels formed",user->nick,chancount());
if (local_count())
- WriteServ(user->fd,"254 %s :I have %d clients and 0 servers",user->nick,local_count());
+ user->WriteServ("254 %s :I have %d clients and 0 servers",user->nick,local_count());
}
diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp
index 9807d0d77..862325f4a 100644
--- a/src/cmd_map.cpp
+++ b/src/cmd_map.cpp
@@ -28,6 +28,6 @@ void cmd_map::Handle (const char** parameters, int pcnt, userrec *user)
// as with /LUSERS this does nothing without a linking
// module to override its behaviour and display something
// better.
- WriteServ(user->fd,"006 %s :%s",user->nick,Config->ServerName);
- WriteServ(user->fd,"007 %s :End of /MAP",user->nick);
+ user->WriteServ("006 %s :%s",user->nick,Config->ServerName);
+ user->WriteServ("007 %s :End of /MAP",user->nick);
}
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index dbf7efee4..dc3003a58 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -76,7 +76,7 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
{
if (match(Config->module_names[i].c_str(),parameters[1]))
{
- WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
+ user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
for (int it = 0; itab[it];)
{
char data[MAXBUF];
@@ -95,25 +95,25 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
}
}
if (*dlist)
- WriteServ(user->fd,"900 %s :%s [ %s]",user->nick,CleanFilename(modulename),dlist);
+ user->WriteServ("900 %s :%s [ %s]",user->nick,CleanFilename(modulename),dlist);
}
- WriteServ(user->fd,"900 %s :=== DEBUG: Implementation counts ===",user->nick);
+ user->WriteServ("900 %s :=== DEBUG: Implementation counts ===",user->nick);
for (int it = 0; itab[it]; it++)
{
if (Config->global_implementation[it])
- WriteServ(user->fd,"900 %s :%s: %d times",user->nick, itab[it],(int)Config->global_implementation[it]);
+ user->WriteServ("900 %s :%s: %d times",user->nick, itab[it],(int)Config->global_implementation[it]);
}
}
}
else
{
- WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
+ user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
}
}
else
{
- WriteServ(user->fd,"900 %s :%s",user->nick,CleanFilename(modulename));
+ user->WriteServ("900 %s :%s",user->nick,CleanFilename(modulename));
}
}
- WriteServ(user->fd,"901 %s :End of MODULES list",user->nick);
+ user->WriteServ("901 %s :End of MODULES list",user->nick);
}
diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp
index ca0ded549..318846d13 100644
--- a/src/cmd_names.cpp
+++ b/src/cmd_names.cpp
@@ -28,7 +28,7 @@ void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
if (!pcnt)
{
- WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick);
+ user->WriteServ("366 %s * :End of /NAMES list.",user->nick);
return;
}
@@ -40,14 +40,14 @@ void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
{
if ((c->modes[CM_SECRET]) && (!c->HasUser(user)))
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, c->name);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, c->name);
return;
}
userlist(user,c);
- WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name);
+ user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, c->name);
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
}
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index cdb37690e..626b97a79 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -93,18 +93,18 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
if (matches_qline(parameters[0]))
{
WriteOpers("*** Q-Lined nickname %s from %s!%s@%s: %s",parameters[0],user->nick,user->ident,user->host,matches_qline(parameters[0]));
- WriteServ(user->fd,"432 %s %s :Invalid nickname: %s",user->nick,parameters[0],matches_qline(parameters[0]));
+ user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0],matches_qline(parameters[0]));
return;
}
if ((Find(parameters[0])) && (Find(parameters[0]) != user))
{
- WriteServ(user->fd,"433 %s %s :Nickname is already in use.",user->nick,parameters[0]);
+ user->WriteServ("433 %s %s :Nickname is already in use.",user->nick,parameters[0]);
return;
}
}
if ((isnick(parameters[0]) == 0) && (IS_LOCAL(user)))
{
- WriteServ(user->fd,"432 %s %s :Erroneous Nickname",user->nick,parameters[0]);
+ user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]);
return;
}
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 378c48f1e..08ae3f260 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -77,12 +77,12 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
{
- WriteServ(user->fd,"404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
+ user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
return;
}
if ((chan->modes[CM_MODERATED]) && (cstatus(user,chan)<STATUS_VOICE))
{
- WriteServ(user->fd,"404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
+ user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
return;
}
}
@@ -98,7 +98,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
if (temp == "")
{
- WriteServ(user->fd,"412 %s No text to send", user->nick);
+ user->WriteServ("412 %s No text to send", user->nick);
return;
}
@@ -109,7 +109,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
else
{
/* no such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
return;
}
@@ -129,7 +129,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
if (dest->fd > -1)
{
// direct write, same server
- WriteTo(user, dest, "NOTICE %s :%s", dest->nick, parameters[1]);
+ user->WriteTo(dest, "NOTICE %s :%s", dest->nick, parameters[1]);
}
FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,parameters[1],0));
@@ -137,6 +137,6 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
else
{
/* no such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
}
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 078150565..eafeb227b 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -96,7 +96,7 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
ChangeDisplayedHost(user,HostName);
if (!isnick(TypeName))
{
- WriteServ(user->fd,"491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
+ user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
WriteOpers("*** CONFIGURATION ERROR! Oper type invalid for OperType '%s'",OperType);
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
return;
@@ -114,7 +114,7 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
{
/* correct oper credentials */
WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType);
- WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType);
+ user->WriteServ("381 %s :You are now an IRC operator of type %s",user->nick,OperType);
if (!user->modes[UM_OPERATOR])
user->Oper(OperType);
}
@@ -122,13 +122,13 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
{
if (!fail2)
{
- WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick);
+ user->WriteServ("491 %s :Invalid oper credentials",user->nick);
WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.",user->nick,user->ident,user->host);
}
else
{
- WriteServ(user->fd,"491 %s :Your oper block does not have a valid opertype associated with it",user->nick);
+ user->WriteServ("491 %s :Your oper block does not have a valid opertype associated with it",user->nick);
WriteOpers("*** CONFIGURATION ERROR! Oper block mismatch for OperType %s",OperType);
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host);
}
diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp
index 1b9680d5d..beb590ab9 100644
--- a/src/cmd_part.cpp
+++ b/src/cmd_part.cpp
@@ -37,6 +37,6 @@ void cmd_part::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd, "401 %s %s :No such channel", user->nick, parameters[0]);
+ user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]);
}
}
diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp
index 1b972efeb..7abb7f2ab 100644
--- a/src/cmd_pass.cpp
+++ b/src/cmd_pass.cpp
@@ -24,7 +24,7 @@ void cmd_pass::Handle (const char** parameters, int pcnt, userrec *user)
// Check to make sure they havnt registered -- Fix by FCS
if (user->registered == REG_ALL)
{
- WriteServ(user->fd,"462 %s :You may not reregister",user->nick);
+ user->WriteServ("462 %s :You may not reregister",user->nick);
return;
}
ConnectClass a = GetClass(user);
diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp
index b30a9d0fa..48bc8e6b0 100644
--- a/src/cmd_ping.cpp
+++ b/src/cmd_ping.cpp
@@ -25,5 +25,5 @@ extern ServerConfig* Config;
void cmd_ping::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"PONG %s :%s",Config->ServerName,parameters[0]);
+ user->WriteServ("PONG %s :%s",Config->ServerName,parameters[0]);
}
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 07b39e96a..415b6ea39 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -75,12 +75,12 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
{
- WriteServ(user->fd,"404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
+ user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
return;
}
if ((chan->modes[CM_MODERATED]) && (cstatus(user,chan)<STATUS_VOICE))
{
- WriteServ(user->fd,"404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
+ user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
return;
}
}
@@ -95,7 +95,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
if (temp == "")
{
- WriteServ(user->fd,"412 %s No text to send", user->nick);
+ user->WriteServ("412 %s No text to send", user->nick);
return;
}
@@ -105,7 +105,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
else
{
/* no such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
return;
}
@@ -116,7 +116,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
if ((IS_LOCAL(user)) && (*dest->awaymsg))
{
/* auto respond with aweh msg */
- WriteServ(user->fd,"301 %s %s :%s",user->nick,dest->nick,dest->awaymsg);
+ user->WriteServ("301 %s %s :%s",user->nick,dest->nick,dest->awaymsg);
}
int MOD_RESULT = 0;
@@ -131,7 +131,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
if (dest->fd > -1)
{
// direct write, same server
- WriteTo(user, dest, "PRIVMSG %s :%s", dest->nick, parameters[1]);
+ user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,parameters[1],0));
@@ -139,6 +139,6 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
else
{
/* no such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
}
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index 6f7570485..0cbe3d8d0 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -55,7 +55,7 @@ void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
}
}
}
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index 7ab8d31dd..64e85a66c 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -66,7 +66,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
*/
if (user->fd > -1)
{
- Write(user->fd,"ERROR :Closing link (%s@%s) [%s%s]",user->ident,user->host,Config->PrefixQuit,parameters[0]);
+ user->Write("ERROR :Closing link (%s@%s) [%s%s]",user->ident,user->host,Config->PrefixQuit,parameters[0]);
WriteOpers("*** Client exiting: %s!%s@%s [%s%s]",user->nick,user->ident,user->host,Config->PrefixQuit,parameters[0]);
WriteCommonExcept(user,"QUIT :%s%s",Config->PrefixQuit,parameters[0]);
}
@@ -80,7 +80,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- Write(user->fd,"ERROR :Closing link (%s@%s) [QUIT]",user->ident,user->host);
+ user->Write("ERROR :Closing link (%s@%s) [QUIT]",user->ident,user->host);
WriteOpers("*** Client exiting: %s!%s@%s [Client exited]",user->nick,user->ident,user->host);
WriteCommonExcept(user,"QUIT :Client exited");
FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,"Client exited"));
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index f01a9b04e..fa62b7c36 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -29,7 +29,7 @@ extern FactoryList factory;
void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"382 %s %s :Rehashing",user->nick,CleanFilename(CONFIG_FILE));
+ user->WriteServ("382 %s %s :Rehashing",user->nick,CleanFilename(CONFIG_FILE));
std::string parameter = "";
if (pcnt)
{
diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp
index 367c8febc..bd41e5595 100644
--- a/src/cmd_server.cpp
+++ b/src/cmd_server.cpp
@@ -21,6 +21,6 @@
void cmd_server::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick);
+ user->WriteServ("666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick);
WriteOpers("*** WARNING: %s attempted to issue a SERVER command and is registered as a user!",user->nick);
}
diff --git a/src/cmd_squit.cpp b/src/cmd_squit.cpp
index 08dee1188..cc496d4bc 100644
--- a/src/cmd_squit.cpp
+++ b/src/cmd_squit.cpp
@@ -24,5 +24,5 @@
*/
void cmd_squit::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd, "NOTICE %s :You are a nub. Load a linking module.", user->nick);
+ user->WriteServ( "NOTICE %s :You are a nub. Load a linking module.", user->nick);
}
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 1af031611..c4871450e 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -57,7 +57,7 @@ void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
string_list values;
DoStats(*parameters[0], user, values);
for (size_t i = 0; i < values.size(); i++)
- Write(user->fd, ":%s", values[i].c_str());
+ user->Write(":%s", values[i].c_str());
}
void DoStats(char statschar, userrec* user, string_list &results)
diff --git a/src/cmd_summon.cpp b/src/cmd_summon.cpp
index c323e2e3c..e85981a50 100644
--- a/src/cmd_summon.cpp
+++ b/src/cmd_summon.cpp
@@ -21,5 +21,5 @@
void cmd_summon::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"445 %s :SUMMON has been disabled (depreciated command)",user->nick);
+ user->WriteServ("445 %s :SUMMON has been disabled (depreciated command)",user->nick);
}
diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp
index 53d06ddca..97904ba8a 100644
--- a/src/cmd_time.cpp
+++ b/src/cmd_time.cpp
@@ -34,6 +34,6 @@ void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
snprintf(tms,26,"%s",asctime(timeinfo));
tms[24] = 0;
- WriteServ(user->fd,"391 %s %s :%s",user->nick,Config->ServerName,tms);
+ user->WriteServ("391 %s %s :%s",user->nick,Config->ServerName,tms);
}
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index e8784e318..1d4d040f5 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -40,22 +40,22 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
{
if ((Ptr->modes[CM_SECRET]) && (!Ptr->HasUser(user)))
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, Ptr->name);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, Ptr->name);
return;
}
if (Ptr->topicset)
{
- WriteServ(user->fd,"332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
- WriteServ(user->fd,"333 %s %s %s %d", user->nick, Ptr->name, Ptr->setby, Ptr->topicset);
+ user->WriteServ("332 %s %s :%s", user->nick, Ptr->name, Ptr->topic);
+ user->WriteServ("333 %s %s %s %d", user->nick, Ptr->name, Ptr->setby, Ptr->topicset);
}
else
{
- WriteServ(user->fd,"331 %s %s :No topic is set.", user->nick, Ptr->name);
+ user->WriteServ("331 %s %s :No topic is set.", user->nick, Ptr->name);
}
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
return;
}
@@ -68,12 +68,12 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
{
if (!Ptr->HasUser(user))
{
- WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name);
+ user->WriteServ("442 %s %s :You're not on that channel!",user->nick, Ptr->name);
return;
}
if ((Ptr->modes[CM_TOPICLOCK]) && (cstatus(user,Ptr)<STATUS_HOP))
{
- WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name);
+ user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name);
return;
}
}
@@ -99,7 +99,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
}
}
diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp
index c2c298d29..ea07ee258 100644
--- a/src/cmd_trace.cpp
+++ b/src/cmd_trace.cpp
@@ -31,16 +31,16 @@ void cmd_trace::Handle (const char** parameters, int pcnt, userrec *user)
{
if (*i->second->oper)
{
- WriteServ(user->fd,"205 %s :Oper 0 %s",user->nick,i->second->nick);
+ user->WriteServ("205 %s :Oper 0 %s",user->nick,i->second->nick);
}
else
{
- WriteServ(user->fd,"204 %s :User 0 %s",user->nick,i->second->nick);
+ user->WriteServ("204 %s :User 0 %s",user->nick,i->second->nick);
}
}
else
{
- WriteServ(user->fd,"203 %s :???? 0 [%s]",user->nick,i->second->host);
+ user->WriteServ("203 %s :???? 0 [%s]",user->nick,i->second->host);
}
}
}
diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp
index 44701d63d..ca1667d1a 100644
--- a/src/cmd_unloadmodule.cpp
+++ b/src/cmd_unloadmodule.cpp
@@ -27,10 +27,10 @@ void cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
if (ServerInstance->UnloadModule(parameters[0]))
{
WriteOpers("*** MODULE UNLOADED: %s",parameters[0]);
- WriteServ(user->fd,"973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
+ user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
}
else
{
- WriteServ(user->fd,"972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
}
}
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 23139c13f..7f00a3c67 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -34,7 +34,7 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
if (!isident(parameters[0])) {
// This kinda Sucks, According to the RFC thou, its either this,
// or "You have already registered" :p -- Craig
- WriteServ(user->fd,"461 %s USER :Not enough parameters",user->nick);
+ user->WriteServ("461 %s USER :Not enough parameters",user->nick);
}
else {
/* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
@@ -48,7 +48,7 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"462 %s :You may not reregister",user->nick);
+ user->WriteServ("462 %s :You may not reregister",user->nick);
return;
}
/* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp
index 977c67667..49a81c402 100644
--- a/src/cmd_userhost.cpp
+++ b/src/cmd_userhost.cpp
@@ -44,5 +44,5 @@ void cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
strlcat(Return,junk,MAXBUF);
}
}
- WriteServ(user->fd,Return);
+ user->WriteServ(Return);
}
diff --git a/src/cmd_users.cpp b/src/cmd_users.cpp
index 3d8b7519d..963f392c1 100644
--- a/src/cmd_users.cpp
+++ b/src/cmd_users.cpp
@@ -21,5 +21,5 @@
void cmd_users::Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"445 %s :USERS has been disabled (depreciated command)",user->nick);
+ user->WriteServ("445 %s :USERS has been disabled (depreciated command)",user->nick);
}
diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp
index b82809a5a..c5c4a13ee 100644
--- a/src/cmd_version.cpp
+++ b/src/cmd_version.cpp
@@ -31,7 +31,7 @@ void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
std::string line5 = "";
int token_counter = 0;
- WriteServ(user->fd,"351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str());
+ user->WriteServ("351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str());
while (!out.eof())
{
@@ -41,7 +41,7 @@ void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
if ((token_counter >= 13) || (out.eof() == true))
{
- WriteServ(user->fd,"005 %s %s:are supported by this server",user->nick,line5.c_str());
+ user->WriteServ("005 %s %s:are supported by this server",user->nick,line5.c_str());
line5 = "";
token_counter = 0;
}
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index 69960000e..bb4a37234 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -231,12 +231,12 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
if ((whoresults.size() < (size_t)Config->MaxWhoResults) && (!opt_unlimit))
{
for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
- WriteServ_NoFormat(user->fd,n->c_str());
- WriteServ(user->fd,"315 %s %s :End of /WHO list.",user->nick, parameters[0]);
+ user->WriteServ(*n);
+ user->WriteServ("315 %s %s :End of /WHO list.",user->nick, parameters[0]);
}
else
{
/* BZZT! Too many results. */
- WriteServ(user->fd,"315 %s %s :Too many results",user->nick, parameters[0]);
+ user->WriteServ("315 %s %s :Too many results",user->nick, parameters[0]);
}
}
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index efa8b44aa..398f2bc31 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -45,10 +45,10 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
// bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER
if (dest->registered == REG_ALL)
{
- WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
+ user->WriteServ("311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
if ((user == dest) || (*user->oper))
{
- WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->GetIPString());
+ user->WriteServ("378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->GetIPString());
}
std::string cl = chlist(dest,user);
if (cl.length())
@@ -59,24 +59,24 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
}
else
{
- WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl.c_str());
+ user->WriteServ("319 %s %s :%s",user->nick, dest->nick, cl.c_str());
}
}
if (*Config->HideWhoisServer && !(*user->oper))
{
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, Config->HideWhoisServer, Config->Network);
+ user->WriteServ("312 %s %s %s :%s",user->nick, dest->nick, Config->HideWhoisServer, Config->Network);
}
else
{
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
+ user->WriteServ("312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
}
if (*dest->awaymsg)
{
- WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg);
+ user->WriteServ("301 %s %s :%s",user->nick, dest->nick, dest->awaymsg);
}
if (*dest->oper)
{
- WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), Config->Network);
+ user->WriteServ("313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), Config->Network);
}
if ((!signon) && (!idle))
{
@@ -85,19 +85,19 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
if (!strcasecmp(user->server,dest->server))
{
// idle time and signon line can only be sent if youre on the same server (according to RFC)
- WriteServ(user->fd,"317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-TIME), dest->signon);
+ user->WriteServ("317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-TIME), dest->signon);
}
else
{
if ((idle) || (signon))
- WriteServ(user->fd,"317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon);
+ user->WriteServ("317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon);
}
- WriteServ(user->fd,"318 %s %s :End of /WHOIS list.",user->nick, dest->nick);
+ user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, dest->nick);
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, nick);
- WriteServ(user->fd,"318 %s %s :End of /WHOIS list.",user->nick, nick);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, nick);
+ user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, nick);
}
}
@@ -115,7 +115,7 @@ void cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
else
{
/* no such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
- WriteServ(user->fd,"318 %s %s :End of /WHOIS list.",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, parameters[0]);
}
}
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index ae3bdb953..39c028618 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -30,7 +30,7 @@ void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
if (i == whowas.end())
{
- WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
}
else
{
@@ -50,22 +50,22 @@ void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
strlcpy(b,asctime(timeinfo),MAXBUF);
b[24] = 0;
- WriteServ(user->fd,"314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos);
+ user->WriteServ("314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos);
if(*user->oper)
- WriteServ(user->fd,"379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
+ user->WriteServ("379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
if(*Config->HideWhoisServer && !(*user->oper))
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], Config->HideWhoisServer, b);
+ user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], Config->HideWhoisServer, b);
else
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], u->server, b);
+ user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], u->server, b);
}
}
else
{
- WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
}
}
- WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]);
+ user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
}
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 637ff71a9..9ae90a75d 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -35,7 +35,7 @@ void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (strchr(parameters[0],'@'))
{
- WriteServ(user->fd,"NOTICE %s :*** You cannot include a username in a zline, a zline must ban only an IP mask",user->nick);
+ user->WriteServ("NOTICE %s :*** You cannot include a username in a zline, a zline must ban only an IP mask",user->nick);
return;
}
if (ip_matches_everyone(parameters[0],user))
@@ -61,7 +61,7 @@ void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,parameters[0]);
}
}
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 922427c28..bcea36439 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -228,27 +228,27 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
{
if (!user->IsModeSet(cm->second->flags_needed))
{
- WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
+ user->WriteServ("481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
return;
}
if (!user->HasPermission(command))
{
- WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str());
+ user->WriteServ("481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str());
return;
}
}
if ((user->registered == REG_ALL) && (!*user->oper) && (cm->second->IsDisabled()))
{
/* command is disabled! */
- WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command.c_str());
+ user->WriteServ("421 %s %s :This command has been disabled.",user->nick,command.c_str());
return;
}
if (items < cm->second->min_params)
{
- WriteServ(user->fd,"461 %s %s :Not enough parameters.", user->nick, command.c_str());
+ user->WriteServ("461 %s %s :Not enough parameters.", user->nick, command.c_str());
/* If syntax is given, display this as the 461 reply */
if ((Config->SyntaxHints) && (cm->second->syntax.length()))
- WriteServ(user->fd,"304 %s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str());
+ user->WriteServ("304 %s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str());
return;
}
if ((user->registered == REG_ALL) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass))
@@ -273,7 +273,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
}
else
{
- WriteServ(user->fd,"451 %s :You have not registered",command.c_str());
+ user->WriteServ("451 %s :You have not registered",command.c_str());
return;
}
}
@@ -281,7 +281,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
else if (user)
{
ServerInstance->stats->statsUnknown++;
- WriteServ(user->fd,"421 %s %s :Unknown command",user->nick,command.c_str());
+ user->WriteServ("421 %s %s :Unknown command",user->nick,command.c_str());
}
}
diff --git a/src/commands.cpp b/src/commands.cpp
index 2e4ae0d8f..db30cace9 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -91,7 +91,7 @@ void split_chlist(userrec* user, userrec* dest, const std::string &cl)
if (line.length() + length - start > 510)
{
- Write_NoFormat(user->fd, line.c_str());
+ user->Write(line);
line = prefix.str();
}
@@ -108,7 +108,7 @@ void split_chlist(userrec* user, userrec* dest, const std::string &cl)
if (line.length())
{
- Write_NoFormat(user->fd, line.c_str());
+ user->Write(line);
}
}
diff --git a/src/configreader.cpp b/src/configreader.cpp
index d776027e7..4811a2547 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -110,8 +110,8 @@ bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
{
if (user)
{
- WriteServ(user->fd,"There were errors in your configuration:");
- WriteServ(user->fd,"You have more than one <%s> tag, this is not permitted.\n",tag);
+ user->WriteServ("There were errors in your configuration:");
+ user->WriteServ("You have more than one <%s> tag, this is not permitted.\n",tag);
}
else
{
@@ -132,8 +132,8 @@ bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
{
if (user)
{
- WriteServ(user->fd,"There were errors in your configuration:");
- WriteServ(user->fd,"You have not defined a <%s> tag, this is required.",tag);
+ user->WriteServ("There were errors in your configuration:");
+ user->WriteServ("You have not defined a <%s> tag, this is required.",tag);
}
else
{
@@ -683,11 +683,11 @@ void ServerConfig::Read(bool bail, userrec* user)
if (user)
{
- WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick);
+ user->WriteServ("NOTICE %s :There were errors in the configuration file:",user->nick);
while(start < errors.length())
{
- WriteServ(user->fd, "NOTICE %s :%s",user->nick, errors.substr(start, 510 - prefixlen).c_str());
+ user->WriteServ("NOTICE %s :%s",user->nick, errors.substr(start, 510 - prefixlen).c_str());
start += 510 - prefixlen;
}
}
@@ -811,14 +811,14 @@ void ServerConfig::Read(bool bail, userrec* user)
WriteOpers("*** REHASH UNLOADED MODULE: %s",removing->c_str());
if (user)
- WriteServ(user->fd,"973 %s %s :Module %s successfully unloaded.",user->nick, removing->c_str(), removing->c_str());
+ user->WriteServ("973 %s %s :Module %s successfully unloaded.",user->nick, removing->c_str(), removing->c_str());
rem++;
}
else
{
if (user)
- WriteServ(user->fd,"972 %s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->ModuleError());
}
}
@@ -830,14 +830,14 @@ void ServerConfig::Read(bool bail, userrec* user)
WriteOpers("*** REHASH LOADED MODULE: %s",adding->c_str());
if (user)
- WriteServ(user->fd,"975 %s %s :Module %s successfully loaded.",user->nick, adding->c_str(), adding->c_str());
+ user->WriteServ("975 %s %s :Module %s successfully loaded.",user->nick, adding->c_str(), adding->c_str());
add++;
}
else
{
if (user)
- WriteServ(user->fd,"974 %s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->ModuleError());
}
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 495a4658b..841006613 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -149,284 +149,6 @@ void readfile(file_cache &F, const char* fname)
log(DEBUG,"readfile: loaded %s, %lu lines",fname,(unsigned long)F.size());
}
-/** Write_NoFormat()
- * Writes a given string in `text' to the socket on fd `sock' - only if the socket
- * is a valid entry in the local FD table.
- */
-void Write_NoFormat(int sock, const char *text)
-{
- char tb[MAXBUF];
- int bytes;
-
- if ((sock < 0) || (!text) || (sock > MAX_DESCRIPTORS))
- return;
-
- if (fd_ref_table[sock])
- {
- bytes = snprintf(tb,MAXBUF,"%s\r\n",text);
-
- if (Config->GetIOHook(fd_ref_table[sock]->GetPort()))
- {
- try
- {
- Config->GetIOHook(fd_ref_table[sock]->GetPort())->OnRawSocketWrite(sock,tb,bytes);
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- fd_ref_table[sock]->AddWriteBuf(tb);
- }
- ServerInstance->stats->statsSent += bytes;
- }
- else
- log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
-}
-
-/** Write()
- * Same as Write_NoFormat(), but formatted printf() style first.
- */
-void Write(int sock, char *text, ...)
-{
- va_list argsPtr;
- char textbuffer[MAXBUF];
- char tb[MAXBUF];
- int bytes;
-
- if ((sock < 0) || (sock > MAX_DESCRIPTORS))
- return;
-
- if (!text)
- {
- log(DEFAULT,"*** BUG *** Write was given an invalid parameter");
- return;
- }
-
- if (fd_ref_table[sock])
- {
-
- va_start(argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
- bytes = snprintf(tb,MAXBUF,"%s\r\n",textbuffer);
-
- if (Config->GetIOHook(fd_ref_table[sock]->GetPort()))
- {
- try
- {
- Config->GetIOHook(fd_ref_table[sock]->GetPort())->OnRawSocketWrite(sock,tb,bytes);
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- fd_ref_table[sock]->AddWriteBuf(tb);
- }
- ServerInstance->stats->statsSent += bytes;
- }
- else
- log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
-}
-
-/** WriteServ_NoFormat()
- * Same as Write_NoFormat(), except prefixes `text' with `:server.name '.
- */
-void WriteServ_NoFormat(int sock, const char* text)
-{
- char tb[MAXBUF];
- int bytes;
-
- if ((sock < 0) || (!text) || (sock > MAX_DESCRIPTORS))
- return;
-
- if (fd_ref_table[sock])
- {
- bytes = snprintf(tb,MAXBUF,":%s %s\r\n",Config->ServerName,text);
-
- if (Config->GetIOHook(fd_ref_table[sock]->GetPort()))
- {
- try
- {
- Config->GetIOHook(fd_ref_table[sock]->GetPort())->OnRawSocketWrite(sock,tb,bytes);
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- fd_ref_table[sock]->AddWriteBuf(tb);
- }
- ServerInstance->stats->statsSent += bytes;
- }
- else
- log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
-}
-
-/** WriteServ()
- * Same as Write(), except `text' is prefixed with `:server.name '.
- */
-void WriteServ(int sock, char* text, ...)
-{
- va_list argsPtr;
- char textbuffer[MAXBUF];
-
- if ((sock < 0) || (sock > MAX_DESCRIPTORS))
- return;
-
- if (!text)
- {
- log(DEFAULT,"*** BUG *** WriteServ was given an invalid parameter");
- return;
- }
-
- if (!fd_ref_table[sock])
- return;
-
- va_start(argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
- WriteServ_NoFormat(sock, textbuffer);
-}
-
-/** WriteFrom_NoFormat()
- * Write `text' to a socket with fd `sock' prefixed with `:n!u@h' - taken from
- * the nick, user, and host of `user'.
- */
-void WriteFrom_NoFormat(int sock, userrec *user, const char* text)
-{
- char tb[MAXBUF];
- int bytes;
-
- if ((sock < 0) || (!text) || (!user) || (sock > MAX_DESCRIPTORS))
- return;
-
- if (fd_ref_table[sock])
- {
- bytes = snprintf(tb,MAXBUF,":%s %s\r\n",user->GetFullHost(),text);
-
- if (Config->GetIOHook(fd_ref_table[sock]->GetPort()))
- {
- try
- {
- Config->GetIOHook(fd_ref_table[sock]->GetPort())->OnRawSocketWrite(sock,tb,bytes);
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- fd_ref_table[sock]->AddWriteBuf(tb);
- }
- ServerInstance->stats->statsSent += bytes;
- }
- else
- log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
-}
-
-/* write text from an originating user to originating user */
-
-void WriteFrom(int sock, userrec *user,char* text, ...)
-{
- va_list argsPtr;
- char textbuffer[MAXBUF];
- char tb[MAXBUF];
- int bytes;
-
- if ((sock < 0) || (sock > MAX_DESCRIPTORS))
- return;
-
- if ((!text) || (!user))
- {
- log(DEFAULT,"*** BUG *** WriteFrom was given an invalid parameter");
- return;
- }
-
- if (fd_ref_table[sock])
- {
-
- va_start(argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
- bytes = snprintf(tb,MAXBUF,":%s %s\r\n",user->GetFullHost(),textbuffer);
-
- if (Config->GetIOHook(fd_ref_table[sock]->GetPort()))
- {
- try
- {
- Config->GetIOHook(fd_ref_table[sock]->GetPort())->OnRawSocketWrite(sock,tb,bytes);
- }
- catch (ModuleException& modexcept)
- {
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
- }
- }
- else
- {
- fd_ref_table[sock]->AddWriteBuf(tb);
- }
-
- ServerInstance->stats->statsSent += bytes;
- }
- else
- log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
-}
-
-/* write text to an destination user from a source user (e.g. user privmsg) */
-
-void WriteTo(userrec *source, userrec *dest,char *data, ...)
-{
- char textbuffer[MAXBUF];
- va_list argsPtr;
-
- if ((!dest) || (!data))
- {
- log(DEFAULT,"*** BUG *** WriteTo was given an invalid parameter");
- return;
- }
-
- if (!IS_LOCAL(dest))
- return;
-
- va_start(argsPtr, data);
- vsnprintf(textbuffer, MAXBUF, data, argsPtr);
- va_end(argsPtr);
-
- // if no source given send it from the server.
- if (!source)
- {
- WriteServ_NoFormat(dest->fd,textbuffer);
- }
- else
- {
- WriteFrom_NoFormat(dest->fd,source,textbuffer);
- }
-}
-
-void WriteTo_NoFormat(userrec *source, userrec *dest, const char *data)
-{
- if ((!dest) || (!data))
- return;
-
- if (!source)
- {
- WriteServ_NoFormat(dest->fd,data);
- }
- else
- {
- WriteFrom_NoFormat(dest->fd,source,data);
- }
-}
std::string GetServerDescription(const char* servername)
{
@@ -484,7 +206,7 @@ void WriteCommon(userrec *u, char* text, ...)
if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
{
already_sent[i->second->fd] = uniq_id;
- WriteFrom_NoFormat(i->second->fd,u,textbuffer);
+ i->second->WriteFrom(u,std::string(textbuffer));
sent_to_at_least_one = true;
}
}
@@ -497,7 +219,7 @@ void WriteCommon(userrec *u, char* text, ...)
*/
if (!sent_to_at_least_one)
{
- WriteFrom_NoFormat(u->fd,u,textbuffer);
+ u->WriteFrom(u,std::string(textbuffer));
}
}
@@ -531,7 +253,7 @@ void WriteCommon_NoFormat(userrec *u, const char* text)
if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
{
already_sent[i->second->fd] = uniq_id;
- WriteFrom_NoFormat(i->second->fd,u,text);
+ i->second->WriteFrom(u,std::string(text));
sent_to_at_least_one = true;
}
}
@@ -544,7 +266,7 @@ void WriteCommon_NoFormat(userrec *u, const char* text)
*/
if (!sent_to_at_least_one)
{
- WriteFrom_NoFormat(u->fd,u,text);
+ u->WriteFrom(u,std::string(text));
}
}
@@ -636,10 +358,10 @@ void WriteCommonExcept(userrec *u, char* text, ...)
if (quit_munge)
{
- WriteFrom_NoFormat(i->second->fd,u,*i->second->oper ? oper_quit : textbuffer);
+ i->second->WriteFrom(u,*i->second->oper ? std::string(oper_quit) : std::string(textbuffer));
}
else
- WriteFrom_NoFormat(i->second->fd,u,textbuffer);
+ i->second->WriteFrom(u,std::string(textbuffer));
}
}
}
@@ -676,7 +398,7 @@ void WriteCommonExcept_NoFormat(userrec *u, const char* text)
if ((IS_LOCAL(i->second)) && (already_sent[i->second->fd] != uniq_id))
{
already_sent[i->second->fd] = uniq_id;
- WriteFrom_NoFormat(i->second->fd,u,text);
+ i->second->WriteFrom(u,text);
}
}
}
@@ -727,7 +449,7 @@ void WriteOpers_NoFormat(const char* text)
if (a->modes[UM_SERVERNOTICE])
{
// send server notices to all with +s
- WriteServ(a->fd,"NOTICE %s :%s",a->nick,text);
+ a->WriteServ("NOTICE %s :%s",a->nick,text);
}
}
}
@@ -749,8 +471,8 @@ void ServerNoticeAll(char* text, ...)
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
- userrec* t = (userrec*)(*i);
- WriteServ_NoFormat(t->fd,formatbuffer);
+ userrec* t = *i;
+ t->WriteServ(std::string(formatbuffer));
}
}
@@ -770,8 +492,8 @@ void ServerPrivmsgAll(char* text, ...)
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
- userrec* t = (userrec*)(*i);
- WriteServ_NoFormat(t->fd,formatbuffer);
+ userrec* t = *i;
+ t->WriteServ(std::string(formatbuffer));
}
}
@@ -826,7 +548,7 @@ void WriteMode(const char* modes, int flags, const char* text, ...)
if (send_to_user)
{
- WriteServ(t->fd,"NOTICE %s :%s",t->nick,textbuffer);
+ t->WriteServ("NOTICE %s :%s",t->nick,textbuffer);
}
}
}
@@ -851,8 +573,8 @@ void NoticeAll(userrec *source, bool local_only, char* text, ...)
for (std::vector<userrec*>::const_iterator i = local_users.begin(); i != local_users.end(); i++)
{
- userrec* t = (userrec*)(*i);
- WriteFrom_NoFormat(t->fd,source,formatbuffer);
+ userrec* t = *i;
+ t->WriteFrom(source,std::string(formatbuffer));
}
}
@@ -881,7 +603,7 @@ void WriteWallOps(userrec *source, bool local_only, char* text, ...)
if ((IS_LOCAL(t)) && (t->modes[UM_WALLOPS]))
{
- WriteTo_NoFormat(source,t,formatbuffer);
+ source->WriteTo(t,std::string(formatbuffer));
}
}
}
@@ -1111,7 +833,7 @@ void userlist(userrec *user,chanrec *c)
if (curlen > (480-NICKMAX))
{
/* list overflowed into multiple numerics */
- WriteServ_NoFormat(user->fd,list);
+ user->WriteServ(list);
/* reset our lengths */
dlen = curlen = snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
@@ -1125,7 +847,7 @@ void userlist(userrec *user,chanrec *c)
/* if whats left in the list isnt empty, send it */
if (numusers)
{
- WriteServ_NoFormat(user->fd,list);
+ user->WriteServ(list);
}
}
@@ -1187,12 +909,12 @@ void send_error(char *s)
userrec* t = (userrec*)(*i);
if (t->registered == REG_ALL)
{
- WriteServ(t->fd,"NOTICE %s :%s",t->nick,s);
+ t->WriteServ("NOTICE %s :%s",t->nick,s);
}
else
{
// fix - unregistered connections receive ERROR, not NOTICE
- Write(t->fd,"ERROR :%s",s);
+ t->Write("ERROR :%s",s);
}
}
}
@@ -1312,30 +1034,30 @@ void ShowMOTD(userrec *user)
{
if (!Config->MOTD.size())
{
- WriteServ(user->fd,"422 %s :Message of the day file is missing.",user->nick);
+ user->WriteServ("422 %s :Message of the day file is missing.",user->nick);
return;
}
- WriteServ(user->fd,"375 %s :%s message of the day", user->nick, Config->ServerName);
+ user->WriteServ("375 %s :%s message of the day", user->nick, Config->ServerName);
for (unsigned int i = 0; i < Config->MOTD.size(); i++)
- WriteServ(user->fd,"372 %s :- %s",user->nick,Config->MOTD[i].c_str());
+ user->WriteServ("372 %s :- %s",user->nick,Config->MOTD[i].c_str());
- WriteServ(user->fd,"376 %s :End of message of the day.", user->nick);
+ user->WriteServ("376 %s :End of message of the day.", user->nick);
}
void ShowRULES(userrec *user)
{
if (!Config->RULES.size())
{
- WriteServ(user->fd,"NOTICE %s :Rules file is missing.",user->nick);
+ user->WriteServ("NOTICE %s :Rules file is missing.",user->nick);
return;
}
- WriteServ(user->fd,"NOTICE %s :%s rules",user->nick,Config->ServerName);
+ user->WriteServ("NOTICE %s :%s rules",user->nick,Config->ServerName);
for (unsigned int i = 0; i < Config->RULES.size(); i++)
- WriteServ(user->fd,"NOTICE %s :%s",user->nick,Config->RULES[i].c_str());
+ user->WriteServ("NOTICE %s :%s",user->nick,Config->RULES[i].c_str());
- WriteServ(user->fd,"NOTICE %s :End of %s rules.",user->nick,Config->ServerName);
+ user->WriteServ("NOTICE %s :End of %s rules.",user->nick,Config->ServerName);
}
// this returns 1 when all modules are satisfied that the user should be allowed onto the irc server
diff --git a/src/message.cpp b/src/message.cpp
index 268cc6554..a786c60cb 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -129,7 +129,7 @@ void ChangeDisplayedHost(userrec* user, const char* host)
FOREACH_MOD(I_OnChangeHost,OnChangeHost(user,host));
}
strlcpy(user->dhost,host,63);
- WriteServ(user->fd,"396 %s %s :is now your hidden host",user->nick,user->dhost);
+ user->WriteServ("396 %s %s :is now your hidden host",user->nick,user->dhost);
}
/* verify that a user's ident and nickname is valid */
diff --git a/src/mode.cpp b/src/mode.cpp
index 35b8b1e65..018f3dde5 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -171,7 +171,7 @@ userrec* ModeParser::SanityChecks(userrec *user,const char *dest,chanrec *chan,i
d = Find(dest);
if (!d)
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, dest);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, dest);
return NULL;
}
return d;
@@ -250,20 +250,20 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec
if (targetchannel)
{
/* Display channel's current mode string */
- WriteServ(user->fd,"324 %s %s +%s",user->nick, targetchannel->name, chanmodes(targetchannel, targetchannel->HasUser(user)));
- WriteServ(user->fd,"329 %s %s %d", user->nick, targetchannel->name, targetchannel->created);
+ user->WriteServ("324 %s %s +%s",user->nick, targetchannel->name, chanmodes(targetchannel, targetchannel->HasUser(user)));
+ user->WriteServ("329 %s %s %d", user->nick, targetchannel->name, targetchannel->created);
return;
}
else if (targetuser)
{
/* Display user's current mode string */
- WriteServ(user->fd,"221 %s :+%s",targetuser->nick,targetuser->FormatModes());
- WriteServ(user->fd, "008 %s :+%s", targetuser->nick, targetuser->FormatNoticeMasks());
+ user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes());
+ user->WriteServ("008 %s :+%s", targetuser->nick, targetuser->FormatNoticeMasks());
return;
}
/* No such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, text);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, text);
return;
}
@@ -321,7 +321,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
* NOT a uline and NOT a servermode,
* OR, NOT halfop or above.
*/
- WriteServ(user->fd,"482 %s %s :You're not a channel (half)operator",user->nick, targetchannel->name);
+ user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick, targetchannel->name);
return;
}
}
@@ -334,7 +334,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
else
{
/* No such nick/channel */
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
return;
}
@@ -455,7 +455,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
else
{
/* No mode handler? Unknown mode character then. */
- WriteServ(user->fd,"472 %s %c :is unknown mode char to me",user->nick, modechar);
+ user->WriteServ("472 %s %c :is unknown mode char to me",user->nick, modechar);
}
break;
}
@@ -471,7 +471,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
}
else
{
- WriteServ(targetuser->fd,"MODE %s %s",targetuser->nick,output_sequence.c_str());
+ targetuser->WriteServ("MODE %s %s",targetuser->nick,output_sequence.c_str());
}
}
else
@@ -484,7 +484,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
}
else
{
- WriteTo(user,targetuser,"MODE %s %s",targetuser->nick,output_sequence.c_str());
+ user->WriteTo(targetuser,"MODE %s %s",targetuser->nick,output_sequence.c_str());
FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence));
}
}
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp
index 569fb6772..8db699b19 100644
--- a/src/modes/cmode_b.cpp
+++ b/src/modes/cmode_b.cpp
@@ -50,9 +50,9 @@ void ModeChannelBan::DisplayList(userrec* user, chanrec* channel)
/* Display the channel banlist */
for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
{
- WriteServ(user->fd,"367 %s %s %s %s %d",user->nick, channel->name, i->data, i->set_by, i->set_time);
+ user->WriteServ("367 %s %s %s %s %d",user->nick, channel->name, i->data, i->set_by, i->set_time);
}
- WriteServ(user->fd,"368 %s %s :End of channel ban list",user->nick, channel->name);
+ user->WriteServ("368 %s %s :End of channel ban list",user->nick, channel->name);
return;
}
@@ -74,7 +74,7 @@ std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *cha
long maxbans = GetMaxBans(chan->name);
if ((unsigned)chan->bans.size() > (unsigned)maxbans)
{
- WriteServ(user->fd,"478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)",user->nick, chan->name,chan->name,maxbans);
+ user->WriteServ("478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)",user->nick, chan->name,chan->name,maxbans);
dest = "";
return dest;
}
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index e9a74fc3e..7f32ad344 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -90,7 +90,7 @@ std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec
{
if ((status < STATUS_OP) && (!is_uline(user->server)))
{
- WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You're not a channel operator",user->nick, chan->name);
return "";
}
}
@@ -118,7 +118,7 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec
{
if ((user != d) && ((status < STATUS_OP) && (!is_uline(user->server))))
{
- WriteServ(user->fd,"482 %s %s :You are not a channel operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You are not a channel operator",user->nick, chan->name);
return "";
}
}
@@ -128,3 +128,4 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec
}
return "";
}
+
diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp
index e75e551b2..22d95d5a9 100644
--- a/src/modes/cmode_o.cpp
+++ b/src/modes/cmode_o.cpp
@@ -81,7 +81,7 @@ std::string ModeChannelOp::AddOp(userrec *user,const char* dest,chanrec *chan,in
{
if ((status < STATUS_OP) && (!is_uline(user->server)))
{
- WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You're not a channel operator",user->nick, chan->name);
return "";
}
}
@@ -112,7 +112,7 @@ std::string ModeChannelOp::DelOp(userrec *user,const char *dest,chanrec *chan,in
{
if ((status < STATUS_OP) && (!is_uline(user->server)) && (IS_LOCAL(user)))
{
- WriteServ(user->fd,"482 %s %s :You are not a channel operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You are not a channel operator",user->nick, chan->name);
return "";
}
}
diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp
index 76978d346..69f64d2da 100644
--- a/src/modes/cmode_v.cpp
+++ b/src/modes/cmode_v.cpp
@@ -81,7 +81,7 @@ std::string ModeChannelVoice::AddVoice(userrec *user,const char* dest,chanrec *c
{
if ((status < STATUS_HOP) && (!is_uline(user->server)))
{
- WriteServ(user->fd,"482 %s %s :You're not a channel (half)operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick, chan->name);
return "";
}
}
@@ -109,7 +109,7 @@ std::string ModeChannelVoice::DelVoice(userrec *user,const char *dest,chanrec *c
{
if ((status < STATUS_HOP) && (!is_uline(user->server)))
{
- WriteServ(user->fd,"482 %s %s :You are not a channel (half)operator",user->nick, chan->name);
+ user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick, chan->name);
return "";
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index a0e150764..65a9f3d9f 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -444,35 +444,6 @@ void Server::SendMode(const char** parameters, int pcnt, userrec *user)
ServerInstance->ModeGrok->Process(parameters,pcnt,user,true);
}
-void Server::Send(int Socket, const std::string &s)
-{
- Write_NoFormat(Socket,s.c_str());
-}
-
-void Server::SendServ(int Socket, const std::string &s)
-{
- WriteServ_NoFormat(Socket,s.c_str());
-}
-
-void Server::SendFrom(int Socket, userrec* User, const std::string &s)
-{
- WriteFrom_NoFormat(Socket,User,s.c_str());
-}
-
-void Server::SendTo(userrec* Source, userrec* Dest, const std::string &s)
-{
- if (!Source)
- {
- // if source is NULL, then the message originates from the local server
- WriteServ_NoFormat(Dest->fd,s.c_str());
- }
- else
- {
- // otherwise it comes from the user specified
- WriteTo_NoFormat(Source,Dest,s.c_str());
- }
-}
-
bool Server::CommonChannels(userrec* u1, userrec* u2)
{
return (common_channels(u1,u2) != 0);
@@ -486,12 +457,12 @@ void Server::DumpText(userrec* User, const std::string &LinePrefix, stringstream
{
if (CompleteLine.length() + Word.length() + 3 > 500)
{
- WriteServ_NoFormat(User->fd,CompleteLine.c_str());
+ User->WriteServ(CompleteLine);
CompleteLine = LinePrefix;
}
CompleteLine = CompleteLine + Word + " ";
}
- WriteServ_NoFormat(User->fd,CompleteLine.c_str());
+ User->WriteServ(CompleteLine);
}
void Server::SendCommon(userrec* User, const std::string &text, bool IncludeSender)
@@ -595,7 +566,7 @@ int Server::CountUsers(chanrec* c)
bool Server::UserToPseudo(userrec* user, const std::string &message)
{
unsigned int old_fd = user->fd;
- Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
+ user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
user->FlushWriteBuf();
user->ClearBuffer();
user->fd = FD_MAGIC_NUMBER;
@@ -632,20 +603,20 @@ bool Server::PseudoToUser(userrec* alive, userrec* zombie, const std::string &me
}
// Fix by brain - cant write the user until their fd table entry is updated
fd_ref_table[zombie->fd] = zombie;
- Write(zombie->fd,":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
+ zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
for (std::vector<ucrec*>::const_iterator i = zombie->chans.begin(); i != zombie->chans.end(); i++)
{
if (((ucrec*)(*i))->channel != NULL)
{
chanrec* Ptr = ((ucrec*)(*i))->channel;
- WriteFrom(zombie->fd,zombie,"JOIN %s",Ptr->name);
+ zombie->WriteFrom(zombie,"JOIN %s",Ptr->name);
if (Ptr->topicset)
{
- WriteServ(zombie->fd,"332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
- WriteServ(zombie->fd,"333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
+ zombie->WriteServ("332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
+ zombie->WriteServ("333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
}
userlist(zombie,Ptr);
- WriteServ(zombie->fd,"366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
+ zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
}
}
if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->fd != FD_MAGIC_NUMBER))
@@ -867,11 +838,11 @@ void ConfigReader::DumpErrors(bool bail, userrec* user)
if (user)
{
- WriteServ(user->fd,"NOTICE %s :There were errors in the configuration file:",user->nick);
+ user->WriteServ("NOTICE %s :There were errors in the configuration file:",user->nick);
while(start < errors.length())
{
- WriteServ(user->fd, "NOTICE %s :%s",user->nick, errors.substr(start, 510 - prefixlen).c_str());
+ user->WriteServ("NOTICE %s :%s",user->nick, errors.substr(start, 510 - prefixlen).c_str());
start += 510 - prefixlen;
}
}
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index a658a60b6..26d231b14 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -135,7 +135,7 @@ class ModuleFilterPCRE : public Module
Srv->SendOpers(std::string("Filter: ")+std::string(user->nick)+
std::string(" had their notice filtered, target was ")+
target+": "+reason);
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+
+ user->WriteServ("NOTICE "+std::string(user->nick)+
" :Your notice has been filtered and opers notified: "+reason);
}
Srv->Log(DEFAULT,std::string("Filter: ")+std::string(user->nick)+
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index bb6718313..3e91959b8 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -179,7 +179,7 @@ public:
* "insufficient awesomeness" (invalid credentials) error
*/
- WriteServ(user->fd, "491 %s :Invalid oper credentials", user->nick);
+ user->WriteServ( "491 %s :Invalid oper credentials", user->nick);
WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!", user->nick, user->ident, user->host);
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host);
}
@@ -192,7 +192,7 @@ public:
*/
log(DEBUG, "Query failed: %s", res->error.Str());
- WriteServ(user->fd, "491 %s :Invalid oper credentials", user->nick);
+ user->WriteServ( "491 %s :Invalid oper credentials", user->nick);
WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s! (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str());
log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host);
}
@@ -236,7 +236,7 @@ public:
strlcpy(user->oper, type.c_str(), NICKMAX-1);
WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str());
- WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s", user->nick, type.c_str());
+ user->WriteServ("381 %s :You are now an IRC operator of type %s", user->nick, type.c_str());
if (!user->modes[UM_OPERATOR])
user->Oper();
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index ce9099d53..216c69c25 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -463,7 +463,7 @@ class ModuleSSLGnuTLS : public Module
// Bugfix, only send this numeric for *our* SSL users
if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->GetPort(), listenports)))
{
- WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
+ source->WriteServ("320 %s %s :is using a secure connection", source->nick, dest->nick);
}
}
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index c9b9d42aa..29b97ba9a 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -535,7 +535,7 @@ class ModuleSSLOpenSSL : public Module
// Bugfix, only send this numeric for *our* SSL users
if(dest->GetExt("ssl", dummy) || (IS_LOCAL(dest) && isin(dest->GetPort(), listenports)))
{
- WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
+ source->WriteServ("320 %s %s :is using a secure connection", source->nick, dest->nick);
}
}
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 93df8e031..6ee50ea07 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -108,7 +108,7 @@ class ModuleAlias : public Module
u = Srv->FindNick(Aliases[i].requires);
if (!u)
{
- Srv->SendServ(user->fd,"401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is currently unavailable. Please try again later.");
+ user->WriteServ("401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is currently unavailable. Please try again later.");
return 1;
}
}
@@ -117,7 +117,7 @@ class ModuleAlias : public Module
if (!Srv->IsUlined(u->server))
{
Srv->SendOpers("*** NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!");
- Srv->SendServ(user->fd,"401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible.");
+ user->WriteServ("401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible.");
return 1;
}
}
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index 5d5b818f7..d43db5292 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -50,8 +50,8 @@ class ModuleAntiBear : public Module
virtual void OnUserRegister(userrec* user)
{
- WriteServ(user->fd,"439 %s :This server has anti-spambot mechanisms enabled.", user->nick);
- WriteServ(user->fd,"931 %s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick);
+ user->WriteServ("439 %s :This server has anti-spambot mechanisms enabled.", user->nick);
+ user->WriteServ("931 %s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick);
}
};
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index b46da5527..2d946fedb 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -143,7 +143,7 @@ public:
if(action == IBLOCK_KILL || action == IBLOCK_KILLOPERS)
userrec::QuitUser(user, "Global message (/amsg or /ame) detected");
else if(action == IBLOCK_NOTICE || action == IBLOCK_NOTICEOPERS)
- WriteServ(user->fd, "NOTICE %s :Global message (/amsg or /ame) detected", user->nick);
+ user->WriteServ( "NOTICE %s :Global message (/amsg or /ame) detected", user->nick);
return 1;
}
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index a15cc67c5..93daeef61 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -90,7 +90,7 @@ public:
}
}
- WriteServ(user->fd, "404 %s %s :Can't send all-CAPS to channel (+P set)", user->nick, c->name);
+ user->WriteServ( "404 %s %s :Can't send all-CAPS to channel (+P set)", user->nick, c->name);
return 1;
}
}
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 4f3e04106..6c987611c 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -95,7 +95,7 @@ class ModuleBlockColour : public Module
case 21:
case 22:
case 31:
- WriteServ(user->fd,"404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
+ user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
return 1;
break;
}
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index 57ab1e91c..1d3d22575 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -89,7 +89,7 @@ class ModuleBotMode : public Module
{
if (dst->IsModeSet('B'))
{
- Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
+ src->WriteServ("335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName());
}
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 7d834db66..3313b47f5 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -84,7 +84,7 @@ class cmd_cban : public command_t
if (parameters[0] == iter->chname)
{
unsigned long remaining = (iter->set_on + iter->length) - TIME;
- WriteServ(user->fd, "386 %s %s :Removed CBAN with %lu seconds left before expiry (%s)", user->nick, iter->chname.c_str(), remaining, iter->reason.c_str());
+ user->WriteServ( "386 %s %s :Removed CBAN with %lu seconds left before expiry (%s)", user->nick, iter->chname.c_str(), remaining, iter->reason.c_str());
cbans.erase(iter);
break;
}
@@ -107,18 +107,18 @@ class cmd_cban : public command_t
if(length > 0)
{
- WriteServ(user->fd, "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str());
+ user->WriteServ( "385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str());
WriteOpers("*** %s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], reason.c_str());
}
else
{
- WriteServ(user->fd, "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], reason.c_str());
+ user->WriteServ( "385 %s %s :Added permenant channel ban (%s)", user->nick, parameters[0], reason.c_str());
WriteOpers("*** %s added permenant channel ban on %s (%s)", user->nick, parameters[0], reason.c_str());
}
}
else
{
- WriteServ(user->fd, "403 %s %s :Invalid channel name", user->nick, parameters[0]);
+ user->WriteServ( "403 %s %s :Invalid channel name", user->nick, parameters[0]);
}
}
}
@@ -168,7 +168,7 @@ class ModuleCBan : public Module
if(iter->chname == cname && !user->modes[UM_OPERATOR])
{
// Channel is banned.
- WriteServ(user->fd, "384 %s %s :Cannot join channel, CBANed (%s)", user->nick, cname, iter->reason.c_str());
+ user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick, cname, iter->reason.c_str());
WriteOpers("*** %s tried to join %s which is CBANed (%s)", user->nick, cname, iter->reason.c_str());
return 1;
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index eae5ba843..31a30de0e 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -37,7 +37,7 @@ class ChanFilter : public ListModeBase
{
if (word.length() > 35)
{
- WriteServ(user->fd, "935 %s %s %s :word is too long for censor list",user->nick, chan->name,word.c_str());
+ user->WriteServ( "935 %s %s %s :word is too long for censor list",user->nick, chan->name,word.c_str());
return false;
}
@@ -46,18 +46,18 @@ class ChanFilter : public ListModeBase
virtual bool TellListTooLong(userrec* user, chanrec* chan, std::string &word)
{
- WriteServ(user->fd,"939 %s %s %s :Channel spamfilter list is full",user->nick, chan->name, word.c_str());
+ user->WriteServ("939 %s %s %s :Channel spamfilter list is full",user->nick, chan->name, word.c_str());
return true;
}
virtual void TellAlreadyOnList(userrec* user, chanrec* chan, std::string &word)
{
- WriteServ(user->fd,"937 %s %s :The word %s is already on the spamfilter list",user->nick, chan->name,word.c_str());
+ user->WriteServ("937 %s %s :The word %s is already on the spamfilter list",user->nick, chan->name,word.c_str());
}
virtual void TellNotSet(userrec* user, chanrec* chan, std::string &word)
{
- WriteServ(user->fd,"938 %s %s :No such spamfilter word is set",user->nick, chan->name);
+ user->WriteServ("938 %s %s :No such spamfilter word is set",user->nick, chan->name);
}
};
@@ -110,7 +110,7 @@ class ModuleChanFilter : public Module
{
if (line.find(i->mask.c_str()) != std::string::npos)
{
- WriteServ(user->fd,"936 %s %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name, i->mask.c_str());
+ user->WriteServ("936 %s %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name, i->mask.c_str());
return 1;
}
}
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index a4bbeee14..85e8d4a78 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -117,7 +117,7 @@ class ChanFounder : public ModeHandler
else
{
// whoops, someones being naughty!
- WriteServ(source->fd,"468 %s %s :Only servers may set channel mode +q",source->nick, channel->name);
+ source->WriteServ("468 %s %s :Only servers may set channel mode +q",source->nick, channel->name);
parameter = "";
return MODEACTION_DENY;
}
@@ -131,10 +131,10 @@ class ChanFounder : public ModeHandler
{
if (cl[i]->GetExt(founder, dummyptr))
{
- WriteServ(user->fd,"386 %s %s %s",user->nick, channel->name,cl[i]->nick);
+ user->WriteServ("386 %s %s %s",user->nick, channel->name,cl[i]->nick);
}
}
- WriteServ(user->fd,"387 %s %s :End of channel founder list",user->nick, channel->name);
+ user->WriteServ("387 %s %s :End of channel founder list",user->nick, channel->name);
}
};
@@ -220,7 +220,7 @@ class ChanProtect : public ModeHandler
else
{
// bzzzt, wrong answer!
- WriteServ(source->fd,"482 %s %s :You are not a channel founder",source->nick, channel->name);
+ source->WriteServ("482 %s %s :You are not a channel founder",source->nick, channel->name);
return MODEACTION_DENY;
}
}
@@ -233,10 +233,10 @@ class ChanProtect : public ModeHandler
{
if (cl[i]->GetExt(protect,dummyptr))
{
- WriteServ(user->fd,"388 %s %s %s",user->nick, channel->name,cl[i]->nick);
+ user->WriteServ("388 %s %s %s",user->nick, channel->name,cl[i]->nick);
}
}
- WriteServ(user->fd,"389 %s %s :End of channel protected user list",user->nick, channel->name);
+ user->WriteServ("389 %s %s :End of channel protected user list",user->nick, channel->name);
}
};
@@ -317,7 +317,7 @@ class ModuleChanProtect : public Module
// Change requested by katsklaw... when the first in is set to get founder,
// to make it clearer that +q has been given, send that one user the +q notice
// so that their client's syncronization and their sanity are left intact.
- WriteServ(user->fd,"MODE %s +q %s",channel->name,user->nick);
+ user->WriteServ("MODE %s +q %s",channel->name,user->nick);
if (user->Extend("cm_founder_"+std::string(channel->name),fakevalue))
{
Srv->Log(DEBUG,"Marked user "+std::string(user->nick)+" as founder for "+std::string(channel->name));
@@ -358,7 +358,7 @@ class ModuleChanProtect : public Module
if (dest->GetExt(founder,dummyptr))
{
log(DEBUG,"Has %s",founder.c_str());
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder");
return ACR_DENY;
}
else
@@ -367,7 +367,7 @@ class ModuleChanProtect : public Module
}
if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr)))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're protected (+a)");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're protected (+a)");
return ACR_DENY;
}
break;
@@ -377,12 +377,12 @@ class ModuleChanProtect : public Module
log(DEBUG,"OnAccessCheck AC_KICK");
if (dest->GetExt(founder,dummyptr))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder");
return ACR_DENY;
}
if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr)))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're protected (+a)");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're protected (+a)");
return ACR_DENY;
}
break;
@@ -391,12 +391,12 @@ class ModuleChanProtect : public Module
case AC_DEHALFOP:
if (dest->GetExt(founder,dummyptr))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're a channel founder");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're a channel founder");
return ACR_DENY;
}
if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr)))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're protected (+a)");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're protected (+a)");
return ACR_DENY;
}
break;
@@ -405,12 +405,12 @@ class ModuleChanProtect : public Module
case AC_DEVOICE:
if (dest->GetExt(founder,dummyptr))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're a channel founder");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're a channel founder");
return ACR_DENY;
}
if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr)))
{
- Srv->SendServ(source->fd,"484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're protected (+a)");
+ source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're protected (+a)");
return ACR_DENY;
}
break;
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 0535c56ee..92b6d64f0 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -63,30 +63,30 @@ class cmd_check : public command_t
* :server.name 304 target :CHECK END
*/
- Srv->SendTo(NULL, user, checkstr + " START " + parameters[0]);
+ user->WriteServ(checkstr + " START " + parameters[0]);
if (targuser)
{
/* /check on a user */
- Srv->SendTo(NULL, user, checkstr + " nuh " + targuser->GetFullHost());
- Srv->SendTo(NULL, user, checkstr + " realnuh " + targuser->GetFullRealHost());
- Srv->SendTo(NULL, user, checkstr + " realname " + targuser->fullname);
- Srv->SendTo(NULL, user, checkstr + " modes +" + targuser->FormatModes());
- Srv->SendTo(NULL, user, checkstr + " server " + targuser->server);
+ user->WriteServ(checkstr + " nuh " + targuser->GetFullHost());
+ user->WriteServ(checkstr + " realnuh " + targuser->GetFullRealHost());
+ user->WriteServ(checkstr + " realname " + targuser->fullname);
+ user->WriteServ(checkstr + " modes +" + targuser->FormatModes());
+ user->WriteServ(checkstr + " server " + targuser->server);
if (targuser->awaymsg[0] != 0)
{
/* user is away */
- Srv->SendTo(NULL, user, checkstr + " awaymsg " + targuser->awaymsg);
+ user->WriteServ(checkstr + " awaymsg " + targuser->awaymsg);
}
if (targuser->oper[0] != 0)
{
/* user is an oper of type ____ */
- Srv->SendTo(NULL, user, checkstr + " opertype " + targuser->oper);
+ user->WriteServ(checkstr + " opertype " + targuser->oper);
}
if (IS_LOCAL(targuser))
{
/* port information is only held for a local user! */
- Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->GetPort()));
+ user->WriteServ(checkstr + " onport " + ConvToStr(targuser->GetPort()));
}
chliststr = chlist(targuser, targuser);
@@ -102,20 +102,20 @@ class cmd_check : public command_t
mytime = gmtime(&creation_time);
strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime);
- Srv->SendTo(NULL, user, checkstr + " created " + timebuf);
+ user->WriteServ(checkstr + " created " + timebuf);
if (targchan->topic[0] != 0)
{
/* there is a topic, assume topic related information exists */
- Srv->SendTo(NULL, user, checkstr + " topic " + targchan->topic);
- Srv->SendTo(NULL, user, checkstr + " topic_setby " + targchan->setby);
+ user->WriteServ(checkstr + " topic " + targchan->topic);
+ user->WriteServ(checkstr + " topic_setby " + targchan->setby);
mytime = gmtime(&topic_time);
strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime);
- Srv->SendTo(NULL, user, checkstr + " topic_setat " + timebuf);
+ user->WriteServ(checkstr + " topic_setat " + timebuf);
}
- Srv->SendTo(NULL, user, checkstr + " modes " + chanmodes(targchan, true));
- Srv->SendTo(NULL, user, checkstr + " membercount " + ConvToStr(targchan->GetUserCounter()));
+ user->WriteServ(checkstr + " modes " + chanmodes(targchan, true));
+ user->WriteServ(checkstr + " membercount " + ConvToStr(targchan->GetUserCounter()));
/* now the ugly bit, spool current members of a channel. :| */
@@ -152,7 +152,7 @@ class cmd_check : public command_t
sprintf(tmpbuf, "%s (%s@%s) %s ", i->second->nick, i->second->ident, i->second->dhost, i->second->fullname);
strcat(ptr, tmpbuf);
- Srv->SendTo(NULL, user, checkstr + " member " + ptr);
+ user->WriteServ(checkstr + " member " + ptr);
}
}
else
@@ -166,20 +166,20 @@ class cmd_check : public command_t
if (match(a->second->host, parameters[0]) || match(a->second->dhost, parameters[0]))
{
/* host or vhost matches mask */
- Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
+ user->WriteServ(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
}
/* IP address */
else if (match(a->second->GetIPString(), parameters[0]))
{
/* same IP. */
- Srv->SendTo(NULL, user, checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
+ user->WriteServ(checkstr + " match " + ConvToStr(++x) + " " + a->second->GetFullRealHost());
}
}
- Srv->SendTo(NULL, user, checkstr + " matches " + ConvToStr(x));
+ user->WriteServ(checkstr + " matches " + ConvToStr(x));
}
- Srv->SendTo(NULL, user, checkstr + " END " + std::string(parameters[0]));
+ user->WriteServ(checkstr + " END " + std::string(parameters[0]));
}
};
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index ff52fcebf..82a94fadc 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -46,14 +46,14 @@ class cmd_chghost : public command_t
{
if (((*x < '0') || (*x > '9')) && (*x != '-'))
{
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
return;
}
}
}
if ((parameters[1] - x) > 63)
{
- WriteServ(user->fd,"NOTICE %s :*** CHGHOST: Host too long",user->nick);
+ user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick);
return;
}
userrec* dest = Srv->FindNick(std::string(parameters[0]));
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index f83460f54..7cb09127a 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -25,7 +25,7 @@ class cmd_chgident : public command_t
{
if(!isident(parameters[1]))
{
- WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick);
+ user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
return;
}
@@ -34,7 +34,7 @@ class cmd_chgident : public command_t
}
else
{
- WriteServ(user->fd, "401 %s %s :No such nick/channel", user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
}
}
};
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index d89030ff9..ecda7cd0c 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -68,10 +68,10 @@ class ModuleWaitPong : public Module
{
char* pingrpl = RandString(10);
- Write(user->fd, "PING :%s", pingrpl);
+ user->Write("PING :%s", pingrpl);
if(sendsnotice)
- WriteServ(user->fd, "NOTICE %s :*** If you are having problems connecting due to ping timeouts, please type /quote PONG %s or /raw PONG %s now.", user->nick, pingrpl, pingrpl);
+ user->WriteServ("NOTICE %s :*** If you are having problems connecting due to ping timeouts, please type /quote PONG %s or /raw PONG %s now.", user->nick, pingrpl, pingrpl);
user->Extend("waitpong_pingstr", pingrpl);
}
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 67e4da607..300d13b4a 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -72,7 +72,7 @@ class ModuleDenyChannels : public Module
else
{
std::string reason = Conf->ReadValue("badchan","reason",j);
- WriteServ(user->fd,"926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
+ user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str());
return 1;
}
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 8dd862ee7..1f7f6358a 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -107,7 +107,7 @@ class ModuleFilter : public Module
Srv->SendOpers(std::string("FILTER: ")+std::string(user->nick)+
std::string(" had their notice filtered, target was ")+
target+": "+f->reason);
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+
+ user->WriteServ("NOTICE "+std::string(user->nick)+
" :Your notice has been filtered and opers notified: "+f->reason);
}
Srv->Log(DEFAULT,std::string("FILTER: ")+std::string(user->nick)+
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index e56dfa79c..ca5bdda7e 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -41,11 +41,11 @@ class cmd_gloadmodule : public command_t
if (ServerInstance->LoadModule(parameters[0]))
{
WriteOpers("*** NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0],user->nick);
- WriteServ(user->fd,"975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
+ user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
}
else
{
- WriteServ(user->fd,"974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
}
}
};
@@ -64,11 +64,11 @@ class cmd_gunloadmodule : public command_t
if (ServerInstance->UnloadModule(parameters[0]))
{
WriteOpers("*** MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0],user->nick);
- WriteServ(user->fd,"973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
+ user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
}
else
{
- WriteServ(user->fd,"972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
}
}
};
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index e503952d6..5680a239b 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -99,7 +99,7 @@ class cmd_helpop : public command_t
if(output != "")
{
- Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output);
+ user->WriteServ("290 "+std::string(user->nick)+" :"+output);
}
}
}
@@ -117,7 +117,7 @@ class cmd_helpop : public command_t
output = helpop->ReadValue("nohelpo", std::string(a), 0);
if (output != "")
{
- Srv->SendTo(NULL,user,"290 "+std::string(user->nick)+" :"+output);
+ user->WriteServ("290 "+std::string(user->nick)+" :"+output);
}
}
// Forward.
@@ -154,7 +154,7 @@ bool do_helpop(const char** parameters, int pcnt, userrec *src)
output = helpop->ReadValue(search, a, 0);
if (output != "")
{
- Srv->SendTo(NULL,src,"290 "+std::string(src->nick)+" :"+output);
+ src->WriteServ("290 "+std::string(src->nick)+" :"+output);
nlines++;
}
}
@@ -249,7 +249,7 @@ class ModuleHelpop : public Module
{
if (dst->IsModeSet('h'))
{
- Srv->SendTo(NULL,src,"310 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is available for help.");
+ src->WriteServ("310 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is available for help.");
}
}
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index de485b2c0..0a9ea8ccc 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -133,7 +133,7 @@ class ModuleHostChange : public Module
}
if (newhost != "")
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost);
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your virtual host: " + newhost);
Srv->ChangeHost(user,newhost);
return;
}
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index fe697e4b7..4de84ea06 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -55,7 +55,7 @@ class RFC1413 : public InspSocket
if (u && (fd_ref_table[ufd] == u))
{
u->Shrink("ident_data");
- Srv->SendServ(u->fd,"NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using "+std::string(u->ident)+" instead.");
+ u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Could not find your ident, using "+std::string(u->ident)+" instead.");
}
}
@@ -87,7 +87,7 @@ class RFC1413 : public InspSocket
{
strlcpy(u->ident,section,IDENTMAX);
Srv->Log(DEBUG,"IDENT SET: "+std::string(u->ident));
- Srv->SendServ(u->fd,"NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
+ u->WriteServ("NOTICE "+std::string(u->nick)+" :*** Found your ident: "+std::string(u->ident));
}
}
return false;
@@ -208,7 +208,7 @@ class ModuleIdent : public Module
* is derived from InspSocket, and inserting it into the socket engine using the
* Server::AddSocket() call.
*/
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Looking up your ident...");
RFC1413* ident = new RFC1413(user, IdentTimeout, Srv);
if (ident->GetState() != I_ERROR)
{
@@ -217,7 +217,7 @@ class ModuleIdent : public Module
}
else
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead.");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not find your ident, using "+std::string(user->ident)+" instead.");
DELETE(ident);
}
}
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index f818484e8..e739e3d92 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -143,7 +143,7 @@ class JoinFlood : public ModeHandler
int nsecs = atoi(secs);
if ((njoins<1) || (nsecs<1))
{
- WriteServ(source->fd,"608 %s %s :Invalid flood parameter",source->nick,channel->name);
+ source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
parameter = "";
return MODEACTION_DENY;
}
@@ -162,7 +162,7 @@ class JoinFlood : public ModeHandler
}
else
{
- WriteServ(source->fd,"608 %s %s :Invalid flood parameter",source->nick,channel->name);
+ source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
return MODEACTION_DENY;
}
}
@@ -206,7 +206,7 @@ class ModuleJoinFlood : public Module
{
if (f->islocked())
{
- WriteServ(user->fd,"609 %s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick,chan->name);
+ user->WriteServ("609 %s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick,chan->name);
return 1;
}
}
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 4f415b8a9..c61f6484f 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -100,7 +100,7 @@ public:
if (iter->first == user)
{
log(DEBUG, "m_kicknorejoin.so: and we have the right user");
- WriteServ(user->fd, "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name);
+ user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name);
return 1;
}
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index e1c021743..8779804c5 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -42,7 +42,7 @@ class cmd_knock : public command_t
if (!c)
{
- WriteServ(user->fd,"401 %s %s :No such channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]);
return;
}
@@ -50,7 +50,7 @@ class cmd_knock : public command_t
if (c->IsModeSet('K'))
{
- WriteServ(user->fd,"480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name);
+ user->WriteServ("480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name);
return;
}
@@ -63,12 +63,12 @@ class cmd_knock : public command_t
if (c->modes[CM_INVITEONLY])
{
c->WriteChannelWithServ((char*)Srv->GetServerName().c_str(), "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str());
- WriteServ(user->fd,"NOTICE %s :KNOCKing on %s",user->nick,c->name);
+ user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name);
return;
}
else
{
- WriteServ(user->fd,"480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name);
+ user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name);
return;
}
}
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 6079eb47b..dbb7cecf1 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -142,7 +142,7 @@ class MsgFlood : public ModeHandler
int nsecs = atoi(secs);
if ((nlines<1) || (nsecs<1))
{
- WriteServ(source->fd,"608 %s %s :Invalid flood parameter",source->nick,channel->name);
+ source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
parameter = "";
return MODEACTION_DENY;
}
@@ -161,7 +161,7 @@ class MsgFlood : public ModeHandler
}
else
{
- WriteServ(source->fd,"608 %s %s :Invalid flood parameter",source->nick,channel->name);
+ source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
parameter = "";
return MODEACTION_DENY;
}
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index 36bf0598d..6369e34d7 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -48,7 +48,7 @@ class cmd_nicklock : public command_t
{
if (source->GetExt("nick_locked", dummy))
{
- WriteServ(user->fd,"946 %s %s :This user's nickname is already locked.",user->nick,source->nick);
+ user->WriteServ("946 %s %s :This user's nickname is already locked.",user->nick,source->nick);
return;
}
if (Srv->IsNick(std::string(parameters[1])))
@@ -81,7 +81,7 @@ class cmd_nickunlock : public command_t
if (source)
{
source->Shrink("nick_locked");
- WriteServ(user->fd,"945 %s %s :Nickname now unlocked.",user->nick,source->nick);
+ user->WriteServ("945 %s %s :Nickname now unlocked.",user->nick,source->nick);
Srv->SendOpers(std::string(user->nick)+" used NICKUNLOCK on "+std::string(parameters[0]));
}
}
@@ -122,7 +122,7 @@ class ModuleNickLock : public Module
{
if (user->GetExt("nick_locked", n))
{
- WriteServ(user->fd,"447 %s :You cannot change your nickname (your nick is locked)",user->nick);
+ user->WriteServ("447 %s :You cannot change your nickname (your nick is locked)",user->nick);
return 1;
}
return 0;
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 1755f8e41..a49e9f622 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -93,7 +93,7 @@ class ModuleNoCTCP : public Module
{
if (strncmp(text.c_str(),"\1ACTION ",8))
{
- WriteServ(user->fd,"492 %s %s :Can't send CTCP to channel (+C set)",user->nick, c->name);
+ user->WriteServ("492 %s %s :Can't send CTCP to channel (+C set)",user->nick, c->name);
return 1;
}
}
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp
index 86b960b63..11a4e9493 100644
--- a/src/modules/m_noinvite.cpp
+++ b/src/modules/m_noinvite.cpp
@@ -81,7 +81,7 @@ class ModuleNoInvite : public Module
{
if (channel->IsModeSet('V'))
{
- WriteServ(user->fd,"492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
+ user->WriteServ("492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick);
return 1;
}
return 0;
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index aa764b18b..5d406ed85 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -91,7 +91,7 @@ class ModuleNoKicks : public Module
else
{
// nobody else can (not even opers with override, and founders)
- WriteServ(source->fd,"484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
+ source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick);
return ACR_DENY;
}
}
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index b225cdba5..b96990cdf 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -103,7 +103,7 @@ class ModuleNoNickChange : public Module
{
// don't allow the nickchange, theyre on at least one channel with +N set
// and theyre not an oper
- WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name);
+ user->WriteServ("447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name);
return 1;
}
}
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 5fe8a8c93..b11bd9d4e 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -85,7 +85,7 @@ class ModuleNoNotice : public Module
}
else
{
- WriteServ(user->fd,"404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
+ user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
return 1;
}
}
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index ebe4bc654..16c988ce8 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -85,7 +85,7 @@ class ModuleOperChans : public Module
{
if (chan->IsModeSet('O'))
{
- WriteServ(user->fd,"520 %s %s :Only IRC operators may join the channel %s (+O is set)",user->nick, chan->name,chan->name);
+ user->WriteServ("520 %s %s :Only IRC operators may join the channel %s (+O is set)",user->nick, chan->name,chan->name);
return 1;
}
}
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 8df45f0fc..6753daae9 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -74,8 +74,8 @@ class ModuleOperLevels : public Module
if (dest_level > source_level)
{
WriteOpers("Oper %s (level %d) attempted to /kill a higher oper: %s (level %d): Reason: %s",source->nick,source_level,dest->nick,dest_level,reason.c_str());
- WriteServ(dest->fd,"NOTICE %s :Oper %s attempted to /kill you!",dest->nick,source->nick);
- WriteServ(source->fd,"481 %s :Permission Denied- Oper %s is a higher level than you",source->nick,dest->nick);
+ dest->WriteServ("NOTICE %s :Oper %s attempted to /kill you!",dest->nick,source->nick);
+ source->WriteServ("481 %s :Permission Denied- Oper %s is a higher level than you",source->nick,dest->nick);
return 1;
}
}
diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp
index 1adf0906f..e8fa613ff 100644
--- a/src/modules/m_opermd5.cpp
+++ b/src/modules/m_opermd5.cpp
@@ -281,7 +281,7 @@ class cmd_mkpasswd : public command_t
{
char buffer[MAXBUF];
GenHash(parameters[0],buffer);
- WriteServ(user->fd,"NOTICE %s :MD5 hashed password for %s is %s",user->nick,parameters[0],buffer);
+ user->WriteServ("NOTICE %s :MD5 hashed password for %s is %s",user->nick,parameters[0],buffer);
}
};
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 4980b74bf..e38d0b827 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -28,18 +28,18 @@ void ShowOperMOTD(userrec* user)
{
if(!opermotd->FileSize())
{
- Srv->SendServ(user->fd,std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
+ user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
return;
}
- Srv->SendServ(user->fd,std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
+ user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
for(int i=0; i != opermotd->FileSize(); i++)
{
- Srv->SendServ(user->fd,std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
+ user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
}
- Srv->SendServ(user->fd,std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
+ user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
}
diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp
index b720118e2..289ea6f7d 100644
--- a/src/modules/m_opersha256.cpp
+++ b/src/modules/m_opersha256.cpp
@@ -237,7 +237,7 @@ public:
{
char buffer[SHA256_BLOCK_SIZE + 1];
SHA256(parameters[0], buffer, strlen(parameters[0]));
- WriteServ(user->fd, "NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer);
+ user->WriteServ( "NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer);
}
};
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index 2a9aad5f0..7b7a0f1b3 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -78,7 +78,7 @@ class cmd_park : public command_t
othersessions++;
if (othersessions >= ConcurrentParks)
{
- Srv->SendServ(user->fd,"927 "+std::string(user->nick)+" :You are already parked up to the maximum number of allowed times.");
+ user->WriteServ("927 "+std::string(user->nick)+" :You are already parked up to the maximum number of allowed times.");
}
else
{
@@ -112,7 +112,7 @@ class cmd_parkstats : public command_t
{
char status[MAXBUF];
snprintf(status,MAXBUF,"NOTICE %s :There are a total of %lu parked clients on this server, with a maximum of %lu parked sessions allowed per user.",user->nick,(unsigned long)pinfo.size(),(unsigned long)ConcurrentParks);
- Srv->SendServ(user->fd,status);
+ user->WriteServ(std::string(status));
}
};
@@ -146,7 +146,7 @@ class cmd_unpark : public command_t
userrec* unpark = Srv->FindNick(std::string(parameters[0]));
if (!unpark)
{
- WriteServ(user->fd,"942 %s %s :Invalid user specified.",user->nick, parameters[0]);
+ user->WriteServ("942 %s %s :Invalid user specified.",user->nick, parameters[0]);
return;
}
awaylog* awy;
@@ -155,7 +155,7 @@ class cmd_unpark : public command_t
unpark->GetExt("park_key", key);
if (!awy)
{
- WriteServ(user->fd,"943 %s %s :This user is not parked.",user->nick, unpark->nick);
+ user->WriteServ("943 %s %s :This user is not parked.",user->nick, unpark->nick);
return;
}
if (*key == atoi(parameters[1]))
@@ -171,20 +171,20 @@ class cmd_unpark : public command_t
}
}
// remove all their old modes
- WriteServ(user->fd,"MODE %s -%s",user->nick,user->FormatModes());
+ user->WriteServ("MODE %s -%s",user->nick,user->FormatModes());
// now, map them to the parked user, while nobody can see :p
Srv->PseudoToUser(user,unpark,"Unparked to "+std::string(parameters[0]));
// set all their new modes
- WriteServ(unpark->fd,"MODE %s +%s",unpark->nick,unpark->FormatModes());
+ unpark->WriteServ("MODE %s +%s",unpark->nick,unpark->FormatModes());
// spool their away log to them
- WriteServ(unpark->fd,"NOTICE %s :*** You are now unparked. You have successfully taken back the nickname and privilages of %s.",unpark->nick,unpark->nick);
+ unpark->WriteServ("NOTICE %s :*** You are now unparked. You have successfully taken back the nickname and privilages of %s.",unpark->nick,unpark->nick);
for (awaylog::iterator i = awy->begin(); i != awy->end(); i++)
{
char timebuf[MAXBUF];
tm *timeinfo = localtime(&i->tm);
strlcpy(timebuf,asctime(timeinfo),MAXBUF);
timebuf[strlen(timebuf)-1] = '\0';
- WriteServ(unpark->fd,"NOTICE %s :From %s at %s: \2%s\2",unpark->nick,i->from.c_str(),timebuf,i->text.c_str());
+ unpark->WriteServ("NOTICE %s :From %s at %s: \2%s\2",unpark->nick,i->from.c_str(),timebuf,i->text.c_str());
}
DELETE(awy);
DELETE(key);
@@ -201,7 +201,7 @@ class cmd_unpark : public command_t
}
else
{
- Srv->SendServ(user->fd,"928 "+std::string(user->nick)+" :Incorrect park key.");
+ user->WriteServ("928 "+std::string(user->nick)+" :Incorrect park key.");
}
}
};
@@ -284,9 +284,9 @@ class ModulePark : public Module
am.from = user->GetFullHost();
am.tm = time(NULL);
awy->push_back(am);
- Srv->SendServ(user->fd,"930 "+std::string(user->nick)+" :User "+std::string(dest->nick)+" is parked. Your message has been stored.");
+ user->WriteServ("930 "+std::string(user->nick)+" :User "+std::string(dest->nick)+" is parked. Your message has been stored.");
}
- else Srv->SendServ(user->fd,"929 "+std::string(user->nick)+" :User "+std::string(dest->nick)+" is parked, but their message queue is full. Message not saved.");
+ else user->WriteServ("929 "+std::string(user->nick)+" :User "+std::string(dest->nick)+" is parked, but their message queue is full. Message not saved.");
}
}
@@ -348,7 +348,7 @@ class ModulePark : public Module
{
char* dummy;
if (dst->GetExt("park_awaylog", dummy))
- Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a parked client");
+ src->WriteServ("335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a parked client");
}
virtual Version GetVersion()
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 12049b376..85e4e34b2 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -51,12 +51,12 @@ class cmd_randquote : public command_t
fsize = quotes->FileSize();
str = quotes->GetLine(rand() % fsize);
sprintf(buf,"NOTICE %s :%s%s%s",user->nick,prefix.c_str(),str.c_str(),suffix.c_str());
- Srv->SendServ(user->fd, buf);
+ user->WriteServ(std::string(buf));
}
else
{
sprintf(buf, "NOTICE %s :Your administrator specified an invalid quotes file, please bug them about this.", user->nick);
- Srv->SendServ(user->fd, buf);
+ user->WriteServ(std::string(buf));
}
return;
}
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index bbddb0f18..c5a7f8e9c 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -54,7 +54,7 @@ class Redirect : public ModeHandler
if (!IsValidChannelName(parameter.c_str()))
{
- WriteServ(source->fd,"403 %s %s :Invalid channel name",source->nick, parameter.c_str());
+ source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str());
parameter = "";
return MODEACTION_DENY;
}
@@ -67,7 +67,7 @@ class Redirect : public ModeHandler
{
if ((c == channel) || (c->IsModeSet('L')))
{
- WriteServ(source->fd,"690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str());
+ source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str());
parameter = "";
return MODEACTION_DENY;
}
@@ -77,7 +77,7 @@ class Redirect : public ModeHandler
{
if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name)))
{
- WriteServ(source->fd,"690 %s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name);
+ source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name);
return MODEACTION_DENY;
}
}
@@ -137,7 +137,7 @@ class ModuleRedirect : public Module
if (Srv->CountUsers(chan) >= chan->limit)
{
std::string channel = chan->GetModeParameter('L');
- WriteServ(user->fd,"470 %s :%s has become full, so you are automatically being transferred to the linked channel %s",user->nick,cname,channel.c_str());
+ user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s",user->nick,cname,channel.c_str());
chanrec::JoinUser(user, channel.c_str(), false);
return 1;
}
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 7452b2f33..a9c478a89 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -92,13 +92,13 @@ class RemoveBase
/* Fix by brain - someone needs to learn to validate their input! */
if (!target || !channel)
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel", user->nick, !target ? username : channame);
+ user->WriteServ("401 %s %s :No such nick/channel", user->nick, !target ? username : channame);
return;
}
if (!channel->HasUser(target))
{
- WriteServ(user->fd, "NOTICE %s :*** The user %s is not on channel %s", user->nick, target->nick, channel->name);
+ user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick, target->nick, channel->name);
return;
}
@@ -183,20 +183,20 @@ class RemoveBase
reason << "Removed by " << user->nick << reasonparam;
channel->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick);
- WriteServ(target->fd, "NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str());
+ target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str());
if (!channel->PartUser(target, reason.str().c_str()))
delete channel;
}
else
{
- WriteServ(user->fd, "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick, target->nick, channel->name);
+ user->WriteServ( "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick, target->nick, channel->name);
}
}
else
{
/* m_nokicks.so was loaded and +Q was set, block! */
- WriteServ(user->fd, "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick, channel->name, target->nick);
+ user->WriteServ( "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick, channel->name, target->nick);
}
}
};
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index a901dfde6..bb804676b 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -72,7 +72,7 @@ class ModuleRestrictChans : public Module
// channel does not yet exist (record is null, about to be created IF we were to allow it)
if (!chan)
{
- WriteServ(user->fd,"530 %s %s :Only IRC operators may create new channels",user->nick,cname,cname);
+ user->WriteServ("530 %s %s :Only IRC operators may create new channels",user->nick,cname,cname);
return 1;
}
}
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index c51ea4850..50d87b353 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -57,7 +57,7 @@ class ModuleRestrictMsg : public Module
// anything else, blocked.
return 0;
}
- WriteServ(user->fd,"531 %s %s :You are not permitted to send private messages to this user",user->nick,u->nick);
+ user->WriteServ("531 %s %s :You are not permitted to send private messages to this user",user->nick,u->nick);
return 1;
}
// however, we must allow channel messages...
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 148040c6c..16455fe11 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -95,7 +95,7 @@ class ListTimer : public InspTimer
{
log(DEBUG,"Channel %ld",ld->list_position);
if (!ld->list_position)
- WriteServ(u->fd,"321 %s Channel :Users Name",u->nick);
+ u->WriteServ("321 %s Channel :Users Name",u->nick);
chan = Srv->GetChannelIndex(ld->list_position);
/* spool details */
bool has_user = (chan && chan->HasUser(u));
@@ -108,7 +108,7 @@ class ListTimer : public InspTimer
/* Increment total plus linefeed */
amount_sent += counter + 4 + Srv->GetServerName().length();
log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
- WriteServ_NoFormat(u->fd,buffer);
+ u->WriteServ(std::string(buffer));
}
}
else
@@ -118,7 +118,7 @@ class ListTimer : public InspTimer
if (!ld->list_ended)
{
ld->list_ended = true;
- WriteServ(u->fd,"323 %s :End of channel list.",u->nick);
+ u->WriteServ("323 %s :End of channel list.",u->nick);
}
}
}
@@ -201,7 +201,7 @@ class ModuleSafeList : public Module
{
if (TIME < (*last_list_time)+60)
{
- WriteServ(user->fd,"NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick);
+ user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick);
return 1;
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 0c7387213..b32ba58ab 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -43,13 +43,13 @@ class cmd_sajoin : public command_t
{
if (Srv->IsUlined(dest->server))
{
- WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+ user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
if (!IsValidChannelName(parameters[1]))
{
/* we didn't need to check this for each character ;) */
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
return;
}
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 561bca613..7a78a15ce 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -42,7 +42,7 @@ class cmd_sanick : public command_t
{
if (Srv->IsUlined(source->server))
{
- WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+ user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
if (Srv->IsNick(std::string(parameters[1])))
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index df44e4671..6d1086bba 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -44,7 +44,7 @@ class cmd_sapart : public command_t
{
if (Srv->IsUlined(dest->server))
{
- WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+ user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 5ede08b67..7f622483c 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -52,7 +52,7 @@ class cmd_saquit : public command_t
{
if (Srv->IsUlined(dest->server))
{
- WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+ user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
return;
}
std::string line = "";
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 97f84f5c7..c1c79f8da 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -63,12 +63,12 @@ class ModuleSecureList : public Module
if ((command == "LIST") && (TIME < (user->signon+60)) && (!*user->oper))
{
- WriteServ(user->fd,"NOTICE %s :*** You cannot list within the first minute of connecting. Please try again later.",user->nick);
+ user->WriteServ("NOTICE %s :*** You cannot list within the first minute of connecting. Please try again later.",user->nick);
/* Some crap clients (read: mIRC, various java chat applets) muck up if they don't
* receive these numerics whenever they send LIST, so give them an empty LIST to mull over.
*/
- WriteServ(user->fd,"321 %s Channel :Users Name",user->nick);
- WriteServ(user->fd,"323 %s :End of channel list.",user->nick);
+ user->WriteServ("321 %s Channel :Users Name",user->nick);
+ user->WriteServ("323 %s :End of channel list.",user->nick);
return 1;
}
return 0;
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index f27e74a4d..9f5e1bdb7 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -46,7 +46,7 @@ class Channel_r : public ModeHandler
else
{
log(DEBUG,"Only a server can set chanmode +r, server and nick are: '%s','%s'",source->nick,source->server);
- Srv->SendServ(source->fd,"500 "+std::string(source->nick)+" :Only a server may modify the +r channel mode");
+ source->WriteServ("500 "+std::string(source->nick)+" :Only a server may modify the +r channel mode");
return MODEACTION_DENY;
}
}
@@ -69,7 +69,7 @@ class User_r : public ModeHandler
else
{
log(DEBUG,"Only a server can set umode +r, server and nick are: '%s','%s'",source->nick, source->server);
- Srv->SendServ(source->fd,"500 "+std::string(source->nick)+" :Only a server may modify the +r user mode");
+ source->WriteServ("500 "+std::string(source->nick)+" :Only a server may modify the +r user mode");
return MODEACTION_DENY;
}
}
@@ -196,7 +196,7 @@ class ModuleServices : public Module
if (dest->IsModeSet('r'))
{
/* user is registered */
- WriteServ(source->fd, "307 %s %s :is a registered nick", source->nick, dest->nick);
+ source->WriteServ("307 %s %s :is a registered nick", source->nick, dest->nick);
}
}
@@ -232,7 +232,7 @@ class ModuleServices : public Module
return 0;
}
// user messaging a +M channel and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need a registered nickname to speak on this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need a registered nickname to speak on this channel");
return 1;
}
}
@@ -247,7 +247,7 @@ class ModuleServices : public Module
return 0;
}
// user messaging a +R user and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need a registered nickname to message this user");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need a registered nickname to message this user");
return 1;
}
}
@@ -273,7 +273,7 @@ class ModuleServices : public Module
return 0;
}
// joining a +R channel and not identified
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need a registered nickname to join this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need a registered nickname to join this channel");
return 1;
}
}
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 64ea36c48..5ffb48f98 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -141,7 +141,7 @@ class ModuleServicesAccount : public Module
if (account)
{
- WriteServ(source->fd, "330 %s %s %s :is logged in as", source->nick, dest->nick, account->c_str());
+ source->WriteServ("330 %s %s %s :is logged in as", source->nick, dest->nick, account->c_str());
}
}
@@ -169,7 +169,7 @@ class ModuleServicesAccount : public Module
}
// user messaging a +M channel and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel");
return 1;
}
}
@@ -186,7 +186,7 @@ class ModuleServicesAccount : public Module
}
// user messaging a +R user and is not registered
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user");
return 1;
}
}
@@ -215,7 +215,7 @@ class ModuleServicesAccount : public Module
return 0;
}
// joining a +R channel and not identified
- Srv->SendServ(user->fd,"477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel");
+ user->WriteServ("477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel");
return 1;
}
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 9b403506d..94e811d79 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -40,7 +40,7 @@ class cmd_sethost : public command_t
{
if (strlen(parameters[0]) > 64)
{
- WriteServ(user->fd,"NOTICE %s :*** SETHOST: Host too long",user->nick);
+ user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
return;
}
for (unsigned int x = 0; x < strlen(parameters[0]); x++)
@@ -49,7 +49,7 @@ class cmd_sethost : public command_t
{
if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-'))
{
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
return;
}
}
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 80333ca8d..a5eb27a9b 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -22,7 +22,7 @@ class cmd_setident : public command_t
if(((parameters[0][x] >= 'A') && (parameters[0][x] <= '}')) || strchr(".-0123456789", parameters[0][x]))
continue;
- WriteServ(user->fd, "NOTICE %s :*** Invalid characters in ident", user->nick);
+ user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
return;
}
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index b388d35eb..f17f69e09 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -40,7 +40,7 @@ class cmd_setidle : public command_t
{
if (atoi(parameters[0]) < 1)
{
- WriteServ(user->fd,"948 %s :Invalid idle time.",user->nick);
+ user->WriteServ("948 %s :Invalid idle time.",user->nick);
return;
}
user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
@@ -48,7 +48,7 @@ class cmd_setidle : public command_t
if (user->signon > user->idle_lastmsg)
user->signon = user->idle_lastmsg;
Srv->SendOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds");
- WriteServ(user->fd,"944 %s :Idle time set.",user->nick);
+ user->WriteServ("944 %s :Idle time set.",user->nick);
}
};
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index c7ba52035..9b51e6204 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -75,7 +75,7 @@ class ModuleShowwhois : public Module
{
if ((dest->IsModeSet('W')) && (source != dest))
{
- WriteServ(dest->fd,"NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host);
+ dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host);
}
}
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index e3cd36f76..855aca0e3 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -55,10 +55,10 @@ class cmd_silence : public command_t
{
for (silencelist::const_iterator c = sl->begin(); c < sl->end(); c++)
{
- WriteServ(user->fd,"271 %s %s %s!*@*",user->nick, user->nick,c->c_str());
+ user->WriteServ("271 %s %s %s!*@*",user->nick, user->nick,c->c_str());
}
}
- WriteServ(user->fd,"272 %s :End of Silence List",user->nick);
+ user->WriteServ("272 %s :End of Silence List",user->nick);
}
else if (pcnt > 0)
{
@@ -84,7 +84,7 @@ class cmd_silence : public command_t
if (listitem == target)
{
sl->erase(i);
- WriteServ(user->fd,"950 %s %s :Removed %s!*@* from silence list",user->nick, user->nick,nick);
+ user->WriteServ("950 %s %s :Removed %s!*@* from silence list",user->nick, user->nick,nick);
// we have modified the vector from within a loop, we must now bail out
return;
}
@@ -118,12 +118,12 @@ class cmd_silence : public command_t
irc::string target = nick;
if (listitem == target)
{
- WriteServ(user->fd,"952 %s %s :%s is already on your silence list",user->nick, user->nick,nick);
+ user->WriteServ("952 %s %s :%s is already on your silence list",user->nick, user->nick,nick);
return;
}
}
sl->push_back(std::string(nick));
- WriteServ(user->fd,"951 %s %s :Added %s!*@* to silence list",user->nick, user->nick,nick);
+ user->WriteServ("951 %s %s :Added %s!*@* to silence list",user->nick, user->nick,nick);
return;
}
}
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 1e908f07b..6ced44c9f 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -614,7 +614,7 @@ class cmd_rconnect : public command_t
void Handle (const char** parameters, int pcnt, userrec *user)
{
- WriteServ(user->fd,"NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick,parameters[0],parameters[1]);
+ user->WriteServ("NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick,parameters[0],parameters[1]);
/* Is this aimed at our server? */
if (Srv->MatchText(Srv->GetServerName(),parameters[0]))
{
@@ -2081,7 +2081,7 @@ class TreeSocket : public InspSocket
std::string reason = params[1];
params[1] = ":" + params[1];
DoOneToAllButSender(prefix,"KILL",params,sourceserv);
- ::Write(who->fd, ":%s KILL %s :%s (%s)", sourceserv.c_str(), who->nick, sourceserv.c_str(), reason.c_str());
+ who->Write(":%s KILL %s :%s (%s)", sourceserv.c_str(), who->nick, sourceserv.c_str(), reason.c_str());
userrec::QuitUser(who,reason);
}
return true;
@@ -2115,7 +2115,7 @@ class TreeSocket : public InspSocket
if (u)
{
- WriteServ(u->fd,"PONG %s %s",params[0].c_str(),params[1].c_str());
+ u->WriteServ("PONG %s %s",params[0].c_str(),params[1].c_str());
}
}
else
@@ -2341,7 +2341,7 @@ class TreeSocket : public InspSocket
if (IS_LOCAL(u))
{
- ::Write(u->fd,"%s",params[1].c_str());
+ u->Write(params[1]);
}
else
{
@@ -2391,7 +2391,7 @@ class TreeSocket : public InspSocket
char tms[26];
snprintf(tms,26,"%s",asctime(timeinfo));
tms[24] = 0;
- WriteServ(u->fd,"391 %s %s :%s",u->nick,prefix.c_str(),tms);
+ u->WriteServ("391 %s %s :%s",u->nick,prefix.c_str(),tms);
}
else
{
@@ -3472,7 +3472,7 @@ class ModuleSpanningTree : public Module
/* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
if ((HideULines) && (Srv->IsUlined(Current->GetName())) && (!*user->oper))
return;
- WriteServ(user->fd,"364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),(FlatLinks && (!*user->oper)) ? Srv->GetServerName().c_str() : Parent.c_str(),(FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str());
+ user->WriteServ("364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),(FlatLinks && (!*user->oper)) ? Srv->GetServerName().c_str() : Parent.c_str(),(FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str());
}
int CountLocalServs()
@@ -3488,7 +3488,7 @@ class ModuleSpanningTree : public Module
void HandleLinks(const char** parameters, int pcnt, userrec* user)
{
ShowLinks(TreeRoot,user,0);
- WriteServ(user->fd,"365 %s * :End of /LINKS list.",user->nick);
+ user->WriteServ("365 %s * :End of /LINKS list.",user->nick);
return;
}
@@ -3502,16 +3502,16 @@ class ModuleSpanningTree : public Module
if (n_users > max_global)
max_global = n_users;
- WriteServ(user->fd,"251 %s :There are %d users and %d invisible on %d servers",user->nick,n_users-usercount_invisible(),usercount_invisible(),this->CountServs());
+ user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick,n_users-usercount_invisible(),usercount_invisible(),this->CountServs());
if (usercount_opers())
- WriteServ(user->fd,"252 %s %d :operator(s) online",user->nick,usercount_opers());
+ user->WriteServ("252 %s %d :operator(s) online",user->nick,usercount_opers());
if (usercount_unknown())
- WriteServ(user->fd,"253 %s %d :unknown connections",user->nick,usercount_unknown());
+ user->WriteServ("253 %s %d :unknown connections",user->nick,usercount_unknown());
if (chancount())
- WriteServ(user->fd,"254 %s %d :channels formed",user->nick,chancount());
- WriteServ(user->fd,"254 %s :I have %d clients and %d servers",user->nick,local_count(),this->CountLocalServs());
- WriteServ(user->fd,"265 %s :Current Local Users: %d Max: %d",user->nick,local_count(),max_local);
- WriteServ(user->fd,"266 %s :Current Global Users: %d Max: %d",user->nick,n_users,max_global);
+ user->WriteServ("254 %s %d :channels formed",user->nick,chancount());
+ user->WriteServ("254 %s :I have %d clients and %d servers",user->nick,local_count(),this->CountLocalServs());
+ user->WriteServ("265 %s :Current Local Users: %d Max: %d",user->nick,local_count(),max_local);
+ user->WriteServ("266 %s :Current Global Users: %d Max: %d",user->nick,n_users,max_global);
return;
}
@@ -3588,7 +3588,7 @@ class ModuleSpanningTree : public Module
}
else
{
- WriteServ(user->fd, "402 %s %s :No such server", user->nick, parameters[0]);
+ user->WriteServ( "402 %s %s :No such server", user->nick, parameters[0]);
}
return 1;
}
@@ -3652,11 +3652,11 @@ class ModuleSpanningTree : public Module
// dump the whole lot to the user. This is the easy bit, honest.
for (int t = 0; t < line; t++)
{
- WriteServ(user->fd,"006 %s :%s",user->nick,&matrix[t][0]);
+ user->WriteServ("006 %s :%s",user->nick,&matrix[t][0]);
}
float avg_users = totusers / totservers;
- WriteServ(user->fd,"270 %s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick,totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users);
- WriteServ(user->fd,"007 %s :End of /MAP",user->nick);
+ user->WriteServ("270 %s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick,totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users);
+ user->WriteServ("007 %s :End of /MAP",user->nick);
return;
}
@@ -3667,7 +3667,7 @@ class ModuleSpanningTree : public Module
{
if (s == TreeRoot)
{
- WriteServ(user->fd,"NOTICE %s :*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** SQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick,parameters[0]);
return 1;
}
TreeSocket* sock = s->GetSocket();
@@ -3680,12 +3680,12 @@ class ModuleSpanningTree : public Module
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** SQUIT: The server \002%s\002 is not directly connected.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** SQUIT: The server \002%s\002 is not directly connected.",user->nick,parameters[0]);
}
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** SQUIT: The server \002%s\002 does not exist on the network.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** SQUIT: The server \002%s\002 does not exist on the network.",user->nick,parameters[0]);
}
return 1;
}
@@ -3708,7 +3708,7 @@ class ModuleSpanningTree : public Module
}
else
{
- WriteServ(user->fd,"402 %s %s :No such server",user->nick,parameters[0]);
+ user->WriteServ("402 %s %s :No such server",user->nick,parameters[0]);
}
}
return 1;
@@ -3728,8 +3728,8 @@ class ModuleSpanningTree : public Module
}
else if (!remote)
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[1]);
- WriteServ(user->fd,"318 %s %s :End of /WHOIS list.",user->nick, parameters[1]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]);
+ user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, parameters[1]);
return 1;
}
}
@@ -3819,7 +3819,7 @@ class ModuleSpanningTree : public Module
if (found)
{
std::string Version = found->GetVersion();
- WriteServ(user->fd,"351 %s :%s",user->nick,Version.c_str());
+ user->WriteServ("351 %s :%s",user->nick,Version.c_str());
if (found == TreeRoot)
{
std::stringstream out(Config->data005);
@@ -3835,7 +3835,7 @@ class ModuleSpanningTree : public Module
if ((token_counter >= 13) || (out.eof() == true))
{
- WriteServ(user->fd,"005 %s %s:are supported by this server",user->nick,line5.c_str());
+ user->WriteServ("005 %s %s:are supported by this server",user->nick,line5.c_str());
line5 = "";
token_counter = 0;
}
@@ -3844,7 +3844,7 @@ class ModuleSpanningTree : public Module
}
else
{
- WriteServ(user->fd,"402 %s %s :No such server",user->nick,parameters[0]);
+ user->WriteServ("402 %s %s :No such server",user->nick,parameters[0]);
}
return 1;
}
@@ -3858,7 +3858,7 @@ class ModuleSpanningTree : public Module
TreeServer* CheckDupe = FindServer(x->Name.c_str());
if (!CheckDupe)
{
- WriteServ(user->fd,"NOTICE %s :*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",user->nick,x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
+ user->WriteServ("NOTICE %s :*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",user->nick,x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
insp_inaddr binip;
/* Do we already have an IP? If so, no need to resolve it. */
@@ -3891,12 +3891,12 @@ class ModuleSpanningTree : public Module
}
else
{
- WriteServ(user->fd,"NOTICE %s :*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",user->nick,x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str());
+ user->WriteServ("NOTICE %s :*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",user->nick,x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str());
return 1;
}
}
}
- WriteServ(user->fd,"NOTICE %s :*** CONNECT: No server matching \002%s\002 could be found in the config file.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** CONNECT: No server matching \002%s\002 could be found in the config file.",user->nick,parameters[0]);
return 1;
}
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index d6f6826a9..b835e2c66 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -71,14 +71,14 @@ void spy_userlist(userrec *user,chanrec *c)
{
/* list overflowed into
* multiple numerics */
- WriteServ_NoFormat(user->fd,list);
+ user->WriteServ(std::string(list));
snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
}
}
/* if whats left in the list isnt empty, send it */
if (list[strlen(list)-1] != ':')
{
- WriteServ_NoFormat(user->fd,list);
+ user->WriteServ(std::string(list));
}
}
@@ -96,12 +96,12 @@ class cmd_spylist : public command_t
void Handle (const char** parameters, int pcnt, userrec *user)
{
WriteOpers("*** Oper %s used SPYLIST to list +s/+p channels and keys.",user->nick);
- WriteServ(user->fd,"321 %s Channel :Users Name",user->nick);
+ user->WriteServ("321 %s Channel :Users Name",user->nick);
for (chan_hash::const_iterator i = chanlist.begin(); i != chanlist.end(); i++)
{
- WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,usercount(i->second),chanmodes(i->second,true),i->second->topic);
+ user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,usercount(i->second),chanmodes(i->second,true),i->second->topic);
}
- WriteServ(user->fd,"323 %s :End of channel list.",user->nick);
+ user->WriteServ("323 %s :End of channel list.",user->nick);
}
};
@@ -120,7 +120,7 @@ class cmd_spynames : public command_t
if (!pcnt)
{
- WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick);
+ user->WriteServ("366 %s * :End of /NAMES list.",user->nick);
return;
}
@@ -133,11 +133,11 @@ class cmd_spynames : public command_t
if (c)
{
spy_userlist(user,c);
- WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name);
+ user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, c->name);
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
}
};
diff --git a/src/modules/m_ssl_dummy.cpp b/src/modules/m_ssl_dummy.cpp
index 7214c416b..1b022c14b 100644
--- a/src/modules/m_ssl_dummy.cpp
+++ b/src/modules/m_ssl_dummy.cpp
@@ -51,7 +51,7 @@ class ModuleSSLDummy : public Module
{
if(dest->GetExt("ssl", dummy))
{
- WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
+ source->WriteServ("320 %s %s :is using a secure connection", source->nick, dest->nick);
}
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index d2a8f6fb1..673c30536 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -24,7 +24,7 @@ class SSLMode : public ModeHandler
{
if(!userlist[i]->GetExt("ssl", dummy))
{
- WriteServ(source->fd, "490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name);
+ source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name);
return MODEACTION_DENY;
}
}
@@ -86,7 +86,7 @@ class ModuleSSLModes : public Module
else
{
// Deny
- WriteServ(user->fd, "489 %s %s :Cannot join channel (+z)", user->nick, cname);
+ user->WriteServ( "489 %s %s :Cannot join channel (+z)", user->nick, cname);
return 1;
}
}
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 7ba046983..88856c1f0 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -105,7 +105,7 @@ class ModuleSWhois : public Module
dest->GetExt("swhois", swhois);
if (swhois)
{
- WriteServ(source->fd,"320 %s %s :%s",source->nick,dest->nick,swhois->c_str());
+ source->WriteServ("320 %s %s :%s",source->nick,dest->nick,swhois->c_str());
}
}
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index fbf220929..b3ecfec06 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -58,14 +58,14 @@ class cmd_tban : public command_t
{
if (!Srv->IsValidMask(parameters[2]))
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Invalid ban mask");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban mask");
return;
}
for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++)
{
if (!strcasecmp(i->data,parameters[2]))
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :The ban "+std::string(parameters[2])+" is already on the banlist of "+std::string(parameters[0]));
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :The ban "+std::string(parameters[2])+" is already on the banlist of "+std::string(parameters[0]));
return;
}
}
@@ -74,7 +74,7 @@ class cmd_tban : public command_t
unsigned long expire = Srv->CalcDuration(parameters[1]) + time(NULL);
if (Srv->CalcDuration(parameters[1]) < 1)
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Invalid ban time");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time");
return;
}
char duration[MAXBUF];
@@ -102,10 +102,10 @@ class cmd_tban : public command_t
}
return;
}
- else WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, channel->name);
+ else user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, channel->name);
return;
}
- WriteServ(user->fd,"401 %s %s :No such channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]);
}
};
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index 35f2e023e..6ee4d9176 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -65,9 +65,9 @@ class cmd_tline : public command_t
}
}
if (n_matched)
- WriteServ(user->fd, "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against %0.0f user(s) (%0.2f%% of the userbase). %0.0f by hostname and %0.0f by IP address.",user->nick, n_counted, parameters[0], n_matched, (n_counted/n_matched)*100, n_match_host, n_match_ip);
+ user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against %0.0f user(s) (%0.2f%% of the userbase). %0.0f by hostname and %0.0f by IP address.",user->nick, n_counted, parameters[0], n_matched, (n_counted/n_matched)*100, n_match_host, n_match_ip);
else
- WriteServ(user->fd, "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against no user(s).", user->nick, n_counted, parameters[0]);
+ user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against no user(s).", user->nick, n_counted, parameters[0]);
}
};
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index 3e9c37a3a..bde81011d 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -45,11 +45,11 @@ class cmd_uninvite : public command_t
{
if (!c)
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[1]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]);
}
else
{
- WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
return;
@@ -59,7 +59,7 @@ class cmd_uninvite : public command_t
{
if (cstatus(user,c) < STATUS_HOP)
{
- WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
+ user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
return;
}
}
@@ -68,18 +68,18 @@ class cmd_uninvite : public command_t
if (!u->IsInvited(xname))
{
- WriteServ(user->fd,"491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
+ user->WriteServ("491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
return;
}
if (!c->HasUser(user))
{
- WriteServ(user->fd,"492 %s %s :You're not on that channel!",user->nick, c->name);
+ user->WriteServ("492 %s %s :You're not on that channel!",user->nick, c->name);
return;
}
u->RemoveInvite(xname);
- WriteServ(user->fd,"494 %s %s %s :Uninvited",user->nick,c->name,u->nick);
- WriteServ(u->fd,"493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick);
+ user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick);
+ u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick);
c->WriteChannelWithServ(Srv->GetServerName().c_str(), "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick);
}
};
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index df633af80..1ad0e1c58 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -49,7 +49,7 @@ class cmd_userip : public command_t
strlcat(Return,junk,MAXBUF);
}
}
- WriteServ(user->fd,Return);
+ user->WriteServ(Return);
}
};
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index a7ce8fd4a..71fadf2f9 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -47,13 +47,13 @@ class cmd_vhost : public command_t
{
if (mask != "")
{
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
Srv->ChangeHost(user,mask);
return;
}
}
}
- Srv->SendServ(user->fd,"NOTICE "+std::string(user->nick)+" :Invalid username or password.");
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
}
};
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 9f8c15e07..888827cfa 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -60,11 +60,11 @@ class cmd_watch : public command_t
userrec* targ = Srv->FindNick(a->target);
if (targ)
{
- WriteServ(user->fd,"604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
+ user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
}
}
}
- WriteServ(user->fd,"607 %s :End of WATCH list",user->nick);
+ user->WriteServ("607 %s :End of WATCH list",user->nick);
}
else if (pcnt > 0)
{
@@ -101,11 +101,11 @@ class cmd_watch : public command_t
userrec* targ = Srv->FindNick(a->target);
if (targ)
{
- WriteServ(user->fd,"604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
+ user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,targ->nick,targ->ident,targ->dhost,targ->age);
}
}
}
- WriteServ(user->fd,"607 %s :End of WATCH list",user->nick);
+ user->WriteServ("607 %s :End of WATCH list",user->nick);
}
else if (!strcasecmp(nick,"S"))
{
@@ -121,8 +121,8 @@ class cmd_watch : public command_t
char* l = (char*)list.c_str();
if (*l == ' ')
l++;
- WriteServ(user->fd,"606 %s :%s",user->nick,l);
- WriteServ(user->fd,"607 %s :End of WATCH S",user->nick);
+ user->WriteServ("606 %s :%s",user->nick,l);
+ user->WriteServ("607 %s :End of WATCH S",user->nick);
}
else if (nick[0] == '-')
{
@@ -138,11 +138,11 @@ class cmd_watch : public command_t
userrec* a = Srv->FindNick(b->target);
if (a)
{
- WriteServ(user->fd,"602 %s %s %s %s %lu :stopped watching",user->nick,a->nick,a->ident,a->dhost,a->age);
+ user->WriteServ("602 %s %s %s %s %lu :stopped watching",user->nick,a->nick,a->ident,a->dhost,a->age);
}
else
{
- WriteServ(user->fd,"602 %s %s * * 0 :stopped watching",user->nick,b->target.c_str());
+ user->WriteServ("602 %s %s * * 0 :stopped watching",user->nick,b->target.c_str());
}
if (n1 == n2)
{
@@ -182,11 +182,11 @@ class cmd_watch : public command_t
userrec* a = Srv->FindNick(nick);
if (a)
{
- WriteServ(user->fd,"604 %s %s %s %s %lu :is online",user->nick,a->nick,a->ident,a->dhost,a->age);
+ user->WriteServ("604 %s %s %s %s %lu :is online",user->nick,a->nick,a->ident,a->dhost,a->age);
}
else
{
- WriteServ(user->fd,"605 %s %s * * 0 :is offline",user->nick,nick);
+ user->WriteServ("605 %s %s * * 0 :is offline",user->nick,nick);
}
}
}
@@ -224,7 +224,7 @@ class Modulewatch : public Module
if (n1 == n2)
{
log(DEBUG,"*** WATCH: On global quit: user %s is in notify of %s",user->nick,a->watcher->nick);
- WriteServ(a->watcher->fd,"601 %s %s %s %s %lu :went offline",a->watcher->nick,user->nick,user->ident,user->dhost,time(NULL));
+ a->watcher->WriteServ("601 %s %s %s %s %lu :went offline",a->watcher->nick,user->nick,user->ident,user->dhost,time(NULL));
}
}
bool done = false;
@@ -256,7 +256,7 @@ class Modulewatch : public Module
if (n1 == n2)
{
log(DEBUG,"*** WATCH: On global connect: user %s is in notify of %s",user->nick,a->watcher->nick);
- WriteServ(a->watcher->fd,"600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
+ a->watcher->WriteServ("600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
}
}
}
@@ -274,13 +274,13 @@ class Modulewatch : public Module
if (n1 == n2)
{
log(DEBUG,"*** WATCH: On global nickchange: old nick %s was on notify list of %s",oldnick.c_str(),a->watcher->nick);
- WriteServ(a->watcher->fd,"601 %s %s %s %s %lu :went offline",a->watcher->nick,oldnick.c_str(),user->ident,user->dhost,time(NULL));
+ a->watcher->WriteServ("601 %s %s %s %s %lu :went offline",a->watcher->nick,oldnick.c_str(),user->ident,user->dhost,time(NULL));
}
else if (n1 == n3)
{
// changed from a nick not on notify to one that is
log(DEBUG,"*** WATCH: On global nickchange: new nick %s is on notify list of %s",user->nick,a->watcher->nick);
- WriteServ(a->watcher->fd,"600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
+ a->watcher->WriteServ("600 %s %s %s %s %lu :arrived online",a->watcher->nick,user->nick,user->ident,user->dhost,user->age);
}
}
}
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index 9c253a074..bf6a457a2 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -162,7 +162,7 @@ void ProcessUser(userrec* cu)
}
else
{
- WriteServ(currfd, "NOTICE %s :Your previous line was too long and was not delivered (Over 512chars) Please shorten it.", current->nick);
+ current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over 512chars) Please shorten it.", current->nick);
current->recvq = "";
}
}
@@ -366,7 +366,7 @@ void DoBackgroundUserStuff(time_t TIME)
curr->nping = TIME+curr->pingmax;
continue;
}
- Write(curr->fd,"PING :%s",Config->ServerName);
+ curr->Write("PING :%s",Config->ServerName);
curr->lastping = 0;
curr->nping = TIME+curr->pingmax;
}
diff --git a/src/users.cpp b/src/users.cpp
index 3ecedaf58..dd075b044 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -3,13 +3,13 @@
* +------------------------------------+
*
* InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * E-mail:
+ * <brain@chatspike.net>
+ * <Craig@chatspike.net>
*
* Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
@@ -20,7 +20,7 @@
#include "connection.h"
#include "users.h"
#include "inspircd.h"
-#include <stdio.h>
+#include <stdarg.h>
#include "inspstring.h"
#include "commands.h"
#include "helperfuncs.h"
@@ -182,19 +182,19 @@ void UserResolver::OnLookupComplete(const std::string &result)
if (*(hostname.c_str()) == ':')
hostname = "0" + hostname;
- WriteServ(this->bound_fd, "NOTICE Auth :*** Found your hostname (%s)", hostname.c_str());
+ this->bound_user->WriteServ("NOTICE Auth :*** Found your hostname (%s)", hostname.c_str());
this->bound_user->dns_done = true;
strlcpy(this->bound_user->dhost, hostname.c_str(),64);
strlcpy(this->bound_user->host, hostname.c_str(),64);
}
else
{
- WriteServ(this->bound_fd, "NOTICE Auth :*** Your hostname is longer than the maximum of 64 characters, using your IP address (%s) instead.", this->bound_user->GetIPString());
+ this->bound_user->WriteServ("NOTICE Auth :*** Your hostname is longer than the maximum of 64 characters, using your IP address (%s) instead.", this->bound_user->GetIPString());
}
}
else
{
- WriteServ(this->bound_fd, "NOTICE Auth :*** Your hostname does not match up with your IP address. Sorry, using your IP address (%s) instead.", this->bound_user->GetIPString());
+ this->bound_user->WriteServ("NOTICE Auth :*** Your hostname does not match up with your IP address. Sorry, using your IP address (%s) instead.", this->bound_user->GetIPString());
}
}
}
@@ -204,7 +204,7 @@ void UserResolver::OnError(ResolverError e, const std::string &errormessage)
if (fd_ref_table[this->bound_fd] == this->bound_user)
{
/* Error message here */
- WriteServ(this->bound_fd, "NOTICE Auth :*** Could not resolve your hostname, using your IP address (%s) instead.", this->bound_user->GetIPString());
+ this->bound_user->WriteServ("NOTICE Auth :*** Could not resolve your hostname, using your IP address (%s) instead.", this->bound_user->GetIPString());
this->bound_user->dns_done = true;
}
}
@@ -618,7 +618,7 @@ const char* userrec::GetWriteError()
void userrec::Oper(const std::string &opertype)
{
this->modes[UM_OPERATOR] = 1;
- WriteServ(this->fd, "MODE %s :+o", this->nick);
+ this->WriteServ("MODE %s :+o", this->nick);
FOREACH_MOD(I_OnOper, OnOper(this, opertype));
log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
strlcpy(this->oper, opertype.c_str(), NICKMAX - 1);
@@ -664,7 +664,7 @@ void userrec::QuitUser(userrec *user,const std::string &quitreason)
reason.resize(MAXQUIT - 1);
if (IS_LOCAL(user))
- Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason.c_str());
+ user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason.c_str());
if (user->registered == REG_ALL)
{
@@ -844,7 +844,7 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
log(DEBUG,"Socket addresses set.");
/* Smarter than your average bear^H^H^H^Hset of strlcpys. */
- for (const char* temp = _new->GetIPString(); *temp && j < 64; temp++, j++)
+ for (const char* temp = _new->GetIPString(); *temp && j < 64; temp++, j++)
_new->dhost[j] = _new->host[j] = *temp;
_new->dhost[j] = _new->host[j] = 0;
@@ -928,7 +928,7 @@ void userrec::AddClient(int socket, int port, bool iscached, insp_inaddr ip)
}
}
- WriteServ(_new->fd,"NOTICE Auth :*** Looking up your hostname...");
+ _new->WriteServ("NOTICE Auth :*** Looking up your hostname...");
}
long userrec::GlobalCloneCount()
@@ -1029,11 +1029,11 @@ void userrec::FullConnect(CullList* Goners)
}
- WriteServ(this->fd,"NOTICE Auth :Welcome to \002%s\002!",Config->Network);
- WriteServ(this->fd,"001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, Config->Network, this->nick, this->ident, this->host);
- WriteServ(this->fd,"002 %s :Your host is %s, running version %s",this->nick,Config->ServerName,VERSION);
- WriteServ(this->fd,"003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
- WriteServ(this->fd,"004 %s %s %s %s %s %s", this->nick, Config->ServerName, VERSION, ServerInstance->ModeGrok->UserModeList().c_str(), ServerInstance->ModeGrok->ChannelModeList().c_str(), ServerInstance->ModeGrok->ParaModeList().c_str());
+ this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",Config->Network);
+ this->WriteServ("001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, Config->Network, this->nick, this->ident, this->host);
+ this->WriteServ("002 %s :Your host is %s, running version %s",this->nick,Config->ServerName,VERSION);
+ this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
+ this->WriteServ("004 %s %s %s %s %s %s", this->nick, Config->ServerName, VERSION, ServerInstance->ModeGrok->UserModeList().c_str(), ServerInstance->ModeGrok->ChannelModeList().c_str(), ServerInstance->ModeGrok->ParaModeList().c_str());
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
// so i'd better split it :)
@@ -1050,7 +1050,7 @@ void userrec::FullConnect(CullList* Goners)
if ((token_counter >= 13) || (out.eof() == true))
{
- WriteServ(this->fd,"005 %s %s:are supported by this server", this->nick, line5.c_str());
+ this->WriteServ("005 %s %s:are supported by this server", this->nick, line5.c_str());
line5 = "";
token_counter = 0;
}
@@ -1276,3 +1276,115 @@ const char* userrec::GetIPString(char* buf)
return "";
}
+
+void userrec::Write(const std::string &text)
+{
+ char tb[MAXBUF];
+ int bytes;
+
+ if ((this->fd < 0) || (this->fd > MAX_DESCRIPTORS))
+ return;
+
+ bytes = snprintf(tb,MAXBUF,"%s\r\n",text.c_str());
+
+ if (Config->GetIOHook(this->GetPort()))
+ {
+ try
+ {
+ Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd,tb,bytes);
+ }
+ catch (ModuleException& modexcept)
+ {
+ log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
+ }
+ }
+ else
+ {
+ this->AddWriteBuf(tb);
+ }
+ ServerInstance->stats->statsSent += bytes;
+}
+
+/** Write()
+ */
+void userrec::Write(const char *text, ...)
+{
+ va_list argsPtr;
+ char textbuffer[MAXBUF];
+
+ va_start(argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ this->Write(std::string(textbuffer));
+}
+
+void userrec::WriteServ(const std::string& text)
+{
+ char textbuffer[MAXBUF];
+
+ snprintf(textbuffer,MAXBUF,":%s %s",Config->ServerName,text.c_str());
+ this->Write(std::string(textbuffer));
+}
+
+/** WriteServ()
+ * Same as Write(), except `text' is prefixed with `:server.name '.
+ */
+void userrec::WriteServ(const char* text, ...)
+{
+ va_list argsPtr;
+ char textbuffer[MAXBUF];
+
+ va_start(argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ this->WriteServ(std::string(textbuffer));
+}
+
+
+void userrec::WriteFrom(userrec *user, const std::string &text)
+{
+ char tb[MAXBUF];
+
+ snprintf(tb,MAXBUF,":%s %s",user->GetFullHost(),text.c_str());
+
+ this->Write(std::string(tb));
+}
+
+
+/* write text from an originating user to originating user */
+
+void userrec::WriteFrom(userrec *user, const char* text, ...)
+{
+ va_list argsPtr;
+ char textbuffer[MAXBUF];
+
+ va_start(argsPtr, text);
+ vsnprintf(textbuffer, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ this->WriteFrom(user, std::string(textbuffer));
+}
+
+
+/* write text to an destination user from a source user (e.g. user privmsg) */
+
+void userrec::WriteTo(userrec *dest, const char *data, ...)
+{
+ char textbuffer[MAXBUF];
+ va_list argsPtr;
+
+ va_start(argsPtr, data);
+ vsnprintf(textbuffer, MAXBUF, data, argsPtr);
+ va_end(argsPtr);
+
+ this->WriteTo(dest, std::string(textbuffer));
+}
+
+void userrec::WriteTo(userrec *dest, const std::string &data)
+{
+ dest->WriteFrom(this, data);
+}
+
+