ircproxy  The Ultimate Cyborg

is_channel.h File Reference


Detailed Description

This file contains the definition of the is_channel functions.

Definition in file is_channel.h.

#include <string>
#include <cstring>
#include "debug.h"

Go to the source code of this file.

Functions

bool is_channel (char const *name)
 Returns true if name is a channel name.
bool is_channel (std::string const &name)
 Returns true if name is a channel name.
bool is_server (char const *name)
 Returns true if name is a server name.
bool is_server (std::string const &name)
 Returns true if name is a server name.
bool is_nick (char const *name)
 Returns true if name is a nick name.
bool is_nick (std::string const &name)
 Returns true if name is a nick name.


Function Documentation

bool is_channel ( char const *  name  )  [inline]

bool is_channel ( std::string const &  name  )  [inline]

Returns true if name is a channel name.

Definition at line 34 of file is_channel.h.

References ASSERT.

00035 {
00036   ASSERT(!name.empty());
00037   char c = name[0];
00038   return c == '#' || c == '&' || (c == '@' && name[1] == '#');
00039 }

bool is_server ( char const *  name  )  [inline]

Returns true if name is a server name.

Definition at line 42 of file is_channel.h.

Referenced by is_nick().

00043 {
00044   return std::strchr(name, '.') != NULL;
00045 }

bool is_server ( std::string const &  name  )  [inline]

Returns true if name is a server name.

Definition at line 48 of file is_channel.h.

00049 {
00050   return name.find('.') != std::string::npos;
00051 }

bool is_nick ( char const *  name  )  [inline]

Returns true if name is a nick name.

Definition at line 54 of file is_channel.h.

References is_channel(), and is_server().

Referenced by Target::add_joined_nick(), ClientSession::create_private_target(), Target::get_joined_nick(), ServerSession::get_nick(), and ClientSession::get_nick().

00055 {
00056   return !is_channel(name) && !is_server(name);
00057 }

bool is_nick ( std::string const &  name  )  [inline]

Returns true if name is a nick name.

Definition at line 60 of file is_channel.h.

References is_channel(), and is_server().

00061 {
00062   return !is_channel(name) && !is_server(name);
00063 }


Copyright © 2005-2007 Carlo Wood.  All rights reserved.