channel.h
上传用户:tany51
上传日期:2013-06-12
资源大小:1397k
文件大小:5k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*
  2.  * Copyright (C) 1998  Mark Baysinger (mbaysing@ucsd.edu)
  3.  * Copyright (C) 1998,1999,2000,2001  Ross Combs (rocombs@cs.nmsu.edu)
  4.  * Copyright (C) 2000  Marco Ziech (mmz@gmx.net)
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License
  8.  * as published by the Free Software Foundation; either version 2
  9.  * of the License, or (at your option) any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program; if not, write to the Free Software
  18.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  */
  20. #ifndef INCLUDED_CHANNEL_TYPES
  21. #define INCLUDED_CHANNEL_TYPES
  22. #ifdef JUST_NEED_TYPES
  23. # include "common/bn_type.h"
  24. #else
  25. # define JUST_NEED_TYPES
  26. # include "common/bn_type.h"
  27. # undef JUST_NEED_TYPES
  28. #endif
  29. # include "account.h"
  30. #ifdef CHANNEL_INTERNAL_ACCESS
  31. #ifdef JUST_NEED_TYPES
  32. # include <stdio.h>
  33. # include "connection.h"
  34. # include "common/list.h"
  35. #else
  36. # define JUST_NEED_TYPES
  37. # include <stdio.h>
  38. # include "connection.h"
  39. # include "common/list.h"
  40. # undef JUST_NEED_TYPES
  41. #endif
  42. #endif
  43. #ifdef CHANNEL_INTERNAL_ACCESS
  44. typedef struct channelmember
  45. {
  46.     /* standalone mode */
  47.     t_connection *         connection;
  48.     struct channelmember * next;
  49. } t_channelmember;
  50. #endif
  51. typedef enum
  52. {
  53.     channel_flags_none=0x00,
  54.     channel_flags_public=0x01,
  55.     channel_flags_moderated=0x02,
  56.     channel_flags_restricted=0x04,
  57.     channel_flags_thevoid=0x08,
  58.     channel_flags_system=0x10,
  59.     channel_flags_official=0x20,
  60.     channel_flags_permanent=0x40,
  61.     channel_flags_allowbots=0x80,
  62.     channel_flags_allowopers=0x100,
  63. channel_flags_clan=0x200
  64. } t_channel_flags;
  65. typedef struct channel
  66. #ifdef CHANNEL_INTERNAL_ACCESS
  67. {
  68.     char const *      name;
  69.     char const *      shortname;  /* short "alias" for permanent channels, NULL if none */
  70.     char const *      country;
  71.     char const *      realmname;
  72.     t_channel_flags   flags;
  73.     int       maxmembers;
  74.     int       currmembers;
  75.     char const *      clienttag;
  76.     unsigned int      id;
  77.     t_channelmember * memberlist;
  78.     t_list *          banlist;    /* of char * */
  79.     char *            logname;    /* NULL if not logged */
  80.     FILE *            log;        /* NULL if not logging */
  81. }
  82. #endif
  83. t_channel;
  84. #endif
  85. #ifndef JUST_NEED_TYPES
  86. #ifndef INCLUDED_CHANNEL_PROTOS
  87. #define INCLUDED_CHANNEL_PROTOS
  88. #define JUST_NEED_TYPES
  89. #include "connection.h"
  90. #include "message.h"
  91. #include "common/list.h"
  92. #undef JUST_NEED_TYPES
  93. #define CHANNEL_NAME_BANNED "THE VOID"
  94. #define CHANNEL_NAME_KICKED "THE VOID"
  95. #define CHANNEL_NAME_CHAT   "Chat"
  96. extern int channel_set_flags(t_connection * c);
  97. extern t_channel * channel_create(char const * fullname, char const * shortname, char const * clienttag, int permflag, int botflag, int operflag, int logflag, char const * country, char const * realmname, int maxmembers, int moderated, int clan) ;
  98. extern int channel_destroy(t_channel * channel);
  99. extern char const * channel_get_name(t_channel const * channel);
  100. extern char const * channel_get_shortname(t_channel const * channel);
  101. extern char const * channel_get_clienttag(t_channel const * channel);
  102. extern t_channel_flags channel_get_flags(t_channel const * channel);
  103. extern int channel_get_permanent(t_channel const * channel);
  104. extern unsigned int channel_get_channelid(t_channel const * channel);
  105. extern int channel_set_channelid(t_channel * channel, unsigned int channelid);
  106. extern int channel_add_connection(t_channel * channel, t_connection * connection);
  107. extern int channel_del_connection(t_channel * channel, t_connection * connection);
  108. extern void channel_update_latency(t_connection * conn);
  109. extern void channel_update_flags(t_connection * conn);
  110. extern void channel_message_log(t_channel const * channel, t_connection * me, int fromuser, char const * text);
  111. extern void channel_message_send(t_channel const * channel, t_message_type type, t_connection * conn, char const * text);
  112. extern int channel_ban_user(t_channel * channel, char const * user);
  113. extern int channel_unban_user(t_channel * channel, char const * user);
  114. extern int channel_check_banning(t_channel const * channel, t_connection const * user);
  115. extern int channel_rejoin(t_connection * conn);
  116. extern t_list * channel_get_banlist(t_channel const * channel);
  117. extern int channel_get_length(t_channel const * channel);
  118. extern int channel_get_max(t_channel const * channel);
  119. extern int channel_get_curr(t_channel const * channel);
  120. extern int channel_account_is_tmpOP(t_channel const * channel, t_account * account);
  121. extern int channel_account_has_tmpVOICE(t_channel const * channel, t_account * account);
  122. extern t_connection * channel_get_first(t_channel const * channel);
  123. extern t_connection * channel_get_next(void);
  124. extern int channellist_create(void);
  125. extern int channellist_destroy(void);
  126. extern int channellist_reload(void);
  127. extern t_list * channellist(void);
  128. extern t_channel * channellist_find_channel_by_name(char const * name, char const * locale, char const * realmname);
  129. extern t_channel * channellist_find_channel_bychannelid(unsigned int channelid);
  130. extern int channellist_get_length(void);
  131. #endif
  132. #endif