-void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...)
-{
- if ((!Ptr) || (!user) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannel was given an invalid parameter");
- return;
- }
- char textbuffer[MAXBUF];
- va_list argsPtr;
- va_start (argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if (otheruser->fd != FD_MAGIC_NUMBER)
- WriteTo_NoFormat(user,otheruser,textbuffer);
- }
-}
-
-void WriteChannel_NoFormat(chanrec* Ptr, userrec* user, const char* text)
-{
- if ((!Ptr) || (!user) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannel was given an invalid parameter");
- return;
- }
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if (otheruser->fd != FD_MAGIC_NUMBER)
- WriteTo_NoFormat(user,otheruser,text);
- }
-}
-
-
-/* write formatted text from a source user to all users on a channel
- * including the sender (NOT for privmsg, notice etc!) doesnt send to
- * users on remote servers */
-
-void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...)
-{
- if ((!Ptr) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannel was given an invalid parameter");
- return;
- }
- char textbuffer[MAXBUF];
- va_list argsPtr;
- va_start (argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if ((otheruser->fd != FD_MAGIC_NUMBER) && (otheruser != user))
- {
- if (!user)
- {
- WriteServ_NoFormat(otheruser->fd,textbuffer);
- }
- else
- {
- WriteTo_NoFormat(user,otheruser,textbuffer);
- }
- }
- }
-}
-
-void WriteChannelLocal_NoFormat(chanrec* Ptr, userrec* user, const char* text)
-{
- if ((!Ptr) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannel was given an invalid parameter");
- return;
- }
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if ((otheruser->fd != FD_MAGIC_NUMBER) && (otheruser != user))
- {
- if (!user)
- {
- WriteServ_NoFormat(otheruser->fd,text);
- }
- else
- {
- WriteTo_NoFormat(user,otheruser,text);
- }
- }
- }
-}
-
-
-
-void WriteChannelWithServ(char* ServName, chanrec* Ptr, char* text, ...)
-{
- if ((!Ptr) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannelWithServ was given an invalid parameter");
- return;
- }
- char textbuffer[MAXBUF];
- va_list argsPtr;
- va_start (argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
-
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if (IS_LOCAL(otheruser))
- WriteServ_NoFormat(otheruser->fd,textbuffer);
- }
-}
-
-void WriteChannelWithServ_NoFormat(char* ServName, chanrec* Ptr, const char* text)
-{
- if ((!Ptr) || (!text))
- {
- log(DEFAULT,"*** BUG *** WriteChannelWithServ was given an invalid parameter");
- return;
- }
- std::map<char*,char*> *ulist= Ptr->GetUsers();
- for (std::map<char*,char*>::iterator i = ulist->begin(); i != ulist->end(); i++)
- {
- char* o = i->second;
- userrec* otheruser = (userrec*)o;
- if (IS_LOCAL(otheruser))
- WriteServ_NoFormat(otheruser->fd,text);
- }
-}
-
-
-
-/* write formatted text from a source user to all users on a channel except
- * for the sender (for privmsg etc) */
-
-void ChanExceptSender(chanrec* Ptr, userrec* user, char status, char* text, ...)
-{
- if ((!Ptr) || (!user) || (!text))
- {
- log(DEFAULT,"*** BUG *** ChanExceptSender was given an invalid parameter");
- return;
- }
- char textbuffer[MAXBUF];
- va_list argsPtr;
- va_start (argsPtr, text);
- vsnprintf(textbuffer, MAXBUF, text, argsPtr);
- va_end(argsPtr);
-
- std::map<char*,char*> *ulist;
- switch (status)