]>
jfr.im git - irc/evilnet/mod.chanfix.git/blob - sqlChannel.h
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 #ifndef __SQLCHANNEL_H
23 #define __SQLCHANNEL_H "$Id$"
42 sqlChannel(sqlManager
*);
43 virtual ~sqlChannel();
45 typedef unsigned int flagType
;
47 static const flagType F_BLOCKED
;
48 static const flagType F_ALERT
;
51 * Channel 'Event' Flags, used in the channelog table.
52 * These flags are used to filter channel log records.
56 static const int EV_MISC
; /* Uncategorised event */
57 static const int EV_NOTE
; /* Miscellaneous notes */
58 static const int EV_CHANFIX
; /* Manual chanfixes */
59 static const int EV_SIMULATE
; /* Fix simulation */
60 static const int EV_BLOCK
; /* Channel block */
61 static const int EV_TEMPBLOCK
; /* Temp channel block */
62 static const int EV_UNTEMPBLOCK
; /* Temp channel block */
63 static const int EV_UNBLOCK
; /* Channel unblock */
64 static const int EV_ALERT
; /* Channel alert */
65 static const int EV_UNALERT
; /* Channel unalert */
66 static const int EV_REQUESTOP
; /* Requestops */
69 * Methods to get data atrributes.
73 inline const unsigned int& getID() const
76 inline const std::string
& getChannel() const
79 inline const flagType
& getFlags() const
82 inline bool getFlag( const flagType
& whichFlag
) const
83 { return (flags
& whichFlag
) ; }
85 inline time_t getLastAttempt() const
88 inline time_t getLastSimAttempt() const
91 inline time_t getFixStart() const
94 inline time_t getSimStart() const
97 inline int getMaxScore() const
100 inline int getAmountSimOpped() const
101 { return amtopped
; }
103 inline int getTMaxScore() const
104 { return tmaxScore
; }
106 inline bool getModesRemoved() const
107 { return modesRemoved
; }
109 inline bool getSimModesRemoved() const
110 { return simModesRemoved
; }
112 inline bool useSQL() const
116 * Methods to set data atrributes.
119 // 'ID' is a primary key and cannot be altered.
121 inline void setID( const unsigned int& _id
)
124 inline void setChannel(const std::string
& _channel
)
125 { channel
= _channel
; }
127 inline void setFlag( const flagType
& whichFlag
)
128 { flags
|= whichFlag
; }
130 inline void removeFlag( const flagType
& whichFlag
)
131 { flags
&= ~whichFlag
; }
133 inline void clearFlags()
136 inline void setLastAttempt (time_t _last
)
139 inline void setLastSimAttempt (time_t _simlast
)
140 { simlast
= _simlast
; }
142 inline void setFixStart(time_t _start
)
145 inline void setSimStart(time_t _simstart
)
146 { simstart
= _simstart
; }
148 inline void setAmountSimOpped(unsigned int _amtopped
)
149 { amtopped
= _amtopped
; }
151 inline void setMaxScore(unsigned int _maxScore
)
152 { maxScore
= _maxScore
; }
154 inline void setTMaxScore(unsigned int _tmaxScore
)
155 { tmaxScore
= _tmaxScore
; }
157 inline void setModesRemoved(bool _modesRemoved
)
158 { modesRemoved
= _modesRemoved
; }
160 inline void setSimModesRemoved(bool _simModesRemoved
)
161 { simModesRemoved
= _simModesRemoved
; }
163 inline void setUseSQL(bool _inSQL
)
166 bool Insert(dbHandle
*);
167 bool Delete(dbHandle
*);
168 bool commit(dbHandle
*);
169 void setAllMembers(dbHandle
*, int);
171 /** Static member for keeping track of max user id */
172 static unsigned long int maxUserId
;
174 void addNote(dbHandle
*, unsigned short, iClient
*, const std::string
&);
175 bool deleteNote(dbHandle
*, unsigned int);
176 bool deleteOldestNote(dbHandle
*);
177 bool deleteAllNotes(dbHandle
*);
178 size_t countNotes(dbHandle
*, unsigned short);
179 const std::string
getLastNote(dbHandle
*, unsigned short, time_t&);
185 std::string user_name
;
190 unsigned int amtopped
;
191 unsigned int maxScore
;
192 unsigned int tmaxScore
;
194 bool simModesRemoved
;
198 sqlManager
* myManager
;
199 }; // class sqlChannel
203 } // namespace gnuworld
205 #endif // __SQLCHANNEL_H