| 1 | /* |
| 2 | * Copyright (C) 2001,2006 Dizzy |
| 3 | * Copyright (C) 2004 Donny Redmond ([email protected]) |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 20 | #include "mail.h"cxx . . $ `<file>/src/bnetd/mail.h`/ |
| 21 | |
| 22 | #include <sstream> |
| 23 | #include <fstream> |
| 24 | #include <iomanip> |
| 25 | #include <cstdio> |
| 26 | #include <cstring> |
| 27 | #include <cstdlib> |
| 28 | #include <cerrno> |
| 29 | #include <algorithm> |
| 30 | #include <vector> |
| 31 | |
| 32 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 33 | #include "compat/mkdir.h"cxx . . $ `<file>/src/compat/mkdir.h`/ |
| 34 | #include "compat/statmacros.h"cxx . . $ `<file>/src/compat/statmacros.h`/ |
| 35 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 36 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 37 | #include "common/xstring.h"cxx . . $ `<file>/src/common/xstring.h`/ |
| 38 | #include "account.h"cxx . . $ `<file>/src/bnetd/account.h`/ |
| 39 | #include "message.h"cxx . . $ `<file>/src/bnetd/message.h`/ |
| 40 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 41 | #include "connection.h"cxx . . $ `<file>/src/bnetd/connection.h`/ |
| 42 | #include "helpfile.h"cxx . . $ `<file>/src/bnetd/helpfile.h`/ |
| 43 | #include "command.h"cxx . . $ `<file>/src/bnetd/command.h`/ |
| 44 | #include "i18n.h"cxx . . $ `<file>/src/bnetd/i18n.h`/ |
| 45 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 46 | |
| 47 | |
| 48 | namespace pvpgncxx . . $ pvpgn/ |
| 49 | { |
| 50 | |
| 51 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 52 | { |
| 53 | |
| 54 | static int identify_mail_functioncxx . . $ pvpgn/bnetd/identify_mail_function(7787e0c995c81e02).(const stdcxx . . $ std/::stringcxx . . $ std/string#&); |
| 55 | static void mail_usagecxx . . $ pvpgn/bnetd/mail_usage(428cd989165da3c5).(t_connectioncxx . . $ pvpgn/bnetd/t_connection#*); |
| 56 | static void mail_func_sendcxx . . $ pvpgn/bnetd/mail_func_send(eaaa44a2dcaaa0e3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection#*, char const *, char const *); |
| 57 | static void mail_func_readcxx . . $ pvpgn/bnetd/mail_func_read(e34d4e827966f3c4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection#*, stdcxx . . $ std/::stringcxx . . $ std/string#); |
| 58 | static void mail_func_deletecxx . . $ pvpgn/bnetd/mail_func_delete(e34d4e827966f3c4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection#*, stdcxx . . $ std/::stringcxx . . $ std/string#); |
| 59 | static unsigned get_mail_quotacxx . . $ pvpgn/bnetd/get_mail_quota(c7ab9369555c44b8).(t_accountcxx . . $ pvpgn/bnetd/t_account# *); |
| 60 | |
| 61 | /* Mail API */ |
| 62 | /* for now this functions are only for internal use */ |
| 63 | |
| 64 | Mailcxx . . $ pvpgn/bnetd/Mail#::Mailcxx . . $ pvpgn/bnetd/Mail#Mail(715d3961e431e701).(const stdcxx . . $ std/::stringcxx . . $ std/string#& sender, const stdcxx . . $ std/::stringcxx . . $ std/string#& message, const stdcxx . . $ std/::time_tcxx . . $ std/time_t# timestamp) |
| 65 | :sender_cxx . . $ pvpgn/bnetd/Mail#sender_.(sender), message_cxx . . $ pvpgn/bnetd/Mail#message_.(message), timestamp_cxx . . $ pvpgn/bnetd/Mail#timestamp_.(timestamp) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | Mailcxx . . $ pvpgn/bnetd/Mail#::~cxx . . $ pvpgn/bnetd/Mail#`~Mail`(ced63f7c635d850d).Mailcxx . . $ pvpgn/bnetd/Mail#() throw() |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | const stdcxx . . $ std/::stringcxx . . $ std/string#& |
| 74 | Mailcxx . . $ pvpgn/bnetd/Mail#::sendercxx . . $ pvpgn/bnetd/Mail#sender(f4fff0029955a25f).() const |
| 75 | { |
| 76 | return sender_cxx . . $ pvpgn/bnetd/Mail#sender_.; |
| 77 | } |
| 78 | |
| 79 | const stdcxx . . $ std/::stringcxx . . $ std/string#& |
| 80 | Mailcxx . . $ pvpgn/bnetd/Mail#::messagecxx . . $ pvpgn/bnetd/Mail#message(f4fff0029955a25f).() const |
| 81 | { |
| 82 | return message_cxx . . $ pvpgn/bnetd/Mail#message_.; |
| 83 | } |
| 84 | |
| 85 | const stdcxx . . $ std/::time_tcxx . . $ std/time_t#& |
| 86 | Mailcxx . . $ pvpgn/bnetd/Mail#::timestampcxx . . $ pvpgn/bnetd/Mail#timestamp(6a0f01c7459e4657).() const |
| 87 | { |
| 88 | return timestamp_cxx . . $ pvpgn/bnetd/Mail#timestamp_.; |
| 89 | } |
| 90 | |
| 91 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::Mailboxcxx . . $ pvpgn/bnetd/Mailbox#Mailbox(cb2f890c2fdad230).(unsigned uid_) |
| 92 | :uidcxx . . $ pvpgn/bnetd/Mailbox#uid.(uid_), pathcxx . . $ pvpgn/bnetd/Mailbox#path.(buildPathcxx . . $ pvpgn/bnetd/Mailbox#buildPath(ed3976f106e8bf8e).(prefs_get_maildircxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).())), mdircxx . . $ pvpgn/bnetd/Mailbox#mdir.(pathcxx . . $ pvpgn/bnetd/Mailbox#path., true) |
| 93 | { |
| 94 | } |
| 95 | |
| 96 | stdcxx . . $ std/::stringcxx . . $ std/string# |
| 97 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::buildPathcxx . . $ pvpgn/bnetd/Mailbox#buildPath(ed3976f106e8bf8e).(const stdcxx . . $ std/::stringcxx . . $ std/string#& root) const |
| 98 | { |
| 99 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# ostrcxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 100 | ostr <<cxx . . $ std/`operator<<`(88df5bef833f7f83). root <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "/" <<cxx . . $ std/`operator<<`(47f1cf32aeb3f1a2). stdcxx . . $ std/::setfillcxx . . $ std/setfill(ade351e831a1374a).('0') <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(6) <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). uidcxx . . $ pvpgn/bnetd/Mailbox#uid.; |
| 101 | return ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).(); |
| 102 | } |
| 103 | |
| 104 | void |
| 105 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::createOpenDircxx . . $ pvpgn/bnetd/Mailbox#createOpenDir(49f6e7a06ebc5aa8).() |
| 106 | { |
| 107 | p_mkdircxx . . $ `src/compat/mkdir.h:51:11`!(prefs_get_maildircxx . . $ pvpgn/bnetd/prefs_get_maildir(33a1f659e94feb42).(), S_IRWXUcxx . . $ `<external>/531885356569766532/stat.h:172:9`! | S_IRGRPcxx . . $ `<external>/531885356569766532/stat.h:180:9`! | S_IXGRPcxx . . $ `<external>/531885356569766532/stat.h:182:9`! | S_IROTHcxx . . $ `<external>/531885356569766532/stat.h:186:9`! | S_IXOTHcxx . . $ `<external>/531885356569766532/stat.h:188:9`!); |
| 108 | p_mkdircxx . . $ `src/compat/mkdir.h:51:11`!(pathcxx . . $ pvpgn/bnetd/Mailbox#path..c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), S_IRWXUcxx . . $ `<external>/531885356569766532/stat.h:172:9`! | S_IXGRPcxx . . $ `<external>/531885356569766532/stat.h:182:9`! | S_IRGRPcxx . . $ `<external>/531885356569766532/stat.h:180:9`! | S_IROTHcxx . . $ `<external>/531885356569766532/stat.h:186:9`! | S_IXOTHcxx . . $ `<external>/531885356569766532/stat.h:188:9`!); |
| 109 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..opencxx . . $ pvpgn/Directory#open(a3b17e0268c60856).(pathcxx . . $ pvpgn/bnetd/Mailbox#path., false); |
| 110 | } |
| 111 | |
| 112 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::~cxx . . $ pvpgn/bnetd/Mailbox#`~Mailbox`(ced63f7c635d850d).Mailboxcxx . . $ pvpgn/bnetd/Mailbox#() throw() |
| 113 | { |
| 114 | } |
| 115 | |
| 116 | unsigned |
| 117 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::sizecxx . . $ pvpgn/bnetd/Mailbox#size(ddd8539a2fcdd4ce).() const |
| 118 | { |
| 119 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 120 | |
| 121 | unsigned count = 0; |
| 122 | while ((mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).())) count++; |
| 123 | return count; |
| 124 | } |
| 125 | |
| 126 | bool |
| 127 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::emptycxx . . $ pvpgn/bnetd/Mailbox#empty(50ce9a9e25b4a850).() const |
| 128 | { |
| 129 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 130 | |
| 131 | if (mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).()) return false; |
| 132 | return true; |
| 133 | } |
| 134 | |
| 135 | void |
| 136 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::delivercxx . . $ pvpgn/bnetd/Mailbox#deliver(c3ca1c130ce09c52).(const stdcxx . . $ std/::stringcxx . . $ std/string#& sender, const stdcxx . . $ std/::stringcxx . . $ std/string#& mess) |
| 137 | { |
| 138 | if (!mdircxx . . $ pvpgn/bnetd/Mailbox#mdir.) |
| 139 | try { |
| 140 | createOpenDircxx . . $ pvpgn/bnetd/Mailbox#createOpenDir(49f6e7a06ebc5aa8).(); |
| 141 | } |
| 142 | catch (const Directorycxx . . $ pvpgn/Directory#::OpenErrorcxx . . $ pvpgn/Directory#OpenError#&) { |
| 143 | ERROR1cxx . . $ `src/common/eventlog.h:74:9`!("could not (re)open directory: '{}'", path.c_str()); |
| 144 | throw DeliverErrorcxx . . $ pvpgn/bnetd/Mailbox#DeliverError#("could not (re)open directory: " +cxx . . $ std/operator+(42c652dfebe55ad7). pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 145 | } |
| 146 | |
| 147 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# ostrcxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 148 | ostr <<cxx . . $ std/`operator<<`(88df5bef833f7f83). pathcxx . . $ pvpgn/bnetd/Mailbox#path. <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '/' <<cxx . . $ std/`operator<<`(47f1cf32aeb3f1a2). stdcxx . . $ std/::setfillcxx . . $ std/setfill(ade351e831a1374a).('0') <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(15) <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). static_cast<unsigned long>(stdcxx . . $ std/::timecxx . . $ std/time(a7cd306b2d326b09).(0)); |
| 149 | |
| 150 | stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream# fdcxx . . $ std/basic_ofstream#basic_ofstream(b8cd37071ce335df).(ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 151 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).fd) { |
| 152 | ERROR1cxx . . $ `src/common/eventlog.h:74:9`!("error opening mail file. check permissions: '{}'", path.c_str()); |
| 153 | throw DeliverErrorcxx . . $ pvpgn/bnetd/Mailbox#DeliverError#("error opening mail file. check permissions: " +cxx . . $ std/operator+(42c652dfebe55ad7). pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 154 | } |
| 155 | |
| 156 | fd <<cxx . . $ std/`operator<<`(88df5bef833f7f83). sender <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/`operator<<`(88df5bef833f7f83). mess <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 157 | } |
| 158 | |
| 159 | Mailcxx . . $ pvpgn/bnetd/Mail# |
| 160 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::readcxx . . $ pvpgn/bnetd/Mailbox#read(68d122ab974fa447).(const stdcxx . . $ std/::stringcxx . . $ std/string#& fname, const stdcxx . . $ std/::time_tcxx . . $ std/time_t#& timestamp) const |
| 161 | { |
| 162 | stdcxx . . $ std/::ifstreamcxx . . $ std/ifstream# fdcxx . . $ std/basic_ifstream#basic_ifstream(b8cd37071ce335df).(fname.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 163 | if (!cxx . . $ std/basic_ios#`operator!`(50ce9a9e25b4a850).fd) { |
| 164 | ERROR1cxx . . $ `src/common/eventlog.h:74:9`!("error opening mail file: {}", fname.c_str()); |
| 165 | throw ReadErrorcxx . . $ pvpgn/bnetd/Mailbox#ReadError#("error opening mail file: " +cxx . . $ std/operator+(42c652dfebe55ad7). fname); |
| 166 | } |
| 167 | |
| 168 | stdcxx . . $ std/::stringcxx . . $ std/string# sendercxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 169 | stdcxx . . $ std/::getlinecxx . . $ std/getline(4ec722ed0b69c2ab).(fd, sender); |
| 170 | |
| 171 | stdcxx . . $ std/::stringcxx . . $ std/string# messagecxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 172 | stdcxx . . $ std/::getlinecxx . . $ std/getline(4ec722ed0b69c2ab).(fd, message); |
| 173 | |
| 174 | return Mailcxx . . $ pvpgn/bnetd/Mail#Mail(715d3961e431e701).(sender, message, timestamp); |
| 175 | } |
| 176 | |
| 177 | Mailcxx . . $ pvpgn/bnetd/Mail# |
| 178 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::readcxx . . $ pvpgn/bnetd/Mailbox#read(af5817b933df5210).(unsigned int idx) const |
| 179 | { |
| 180 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 181 | const char * dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).(); |
| 182 | for (unsigned i = 0; i < idx && (dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).());) |
| 183 | if (dentry[0] != '.') ++i; |
| 184 | if (!dentry) { |
| 185 | INFO0cxx . . $ `src/common/eventlog.h:83:9`!("mail not found"); |
| 186 | throw ReadErrorcxx . . $ pvpgn/bnetd/Mailbox#ReadError#("mail not found"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 187 | } |
| 188 | |
| 189 | stdcxx . . $ std/::stringcxx . . $ std/string# fnamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 190 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '/'; |
| 191 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). dentry; |
| 192 | |
| 193 | return readcxx . . $ pvpgn/bnetd/Mailbox#read(68d122ab974fa447).(fname, stdcxx . . $ std/::atoi(dentry)); |
| 194 | } |
| 195 | |
| 196 | void |
| 197 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::readAllcxx . . $ pvpgn/bnetd/Mailbox#readAll(ce7a057c2f96e783).(MailListcxx . . $ pvpgn/bnetd/MailList#& dest) const |
| 198 | { |
| 199 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 200 | |
| 201 | stdcxx . . $ std/::stringcxx . . $ std/string# fnamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 202 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '/'; |
| 203 | |
| 204 | const char* dentry; |
| 205 | while ((dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).())) { |
| 206 | if (dentry[0] == '.') continue; |
| 207 | |
| 208 | try { |
| 209 | dest.push_backcxx . . $ std/deque#push_back(fe7a8a4d1eddb70).(readcxx . . $ pvpgn/bnetd/Mailbox#read(68d122ab974fa447).(fname +cxx . . $ std/operator+(40fc1db9226233c6). dentry, stdcxx . . $ std/::atoi(dentry))); |
| 210 | } |
| 211 | catch (const ReadErrorcxx . . $ pvpgn/bnetd/Mailbox#ReadError#&) { |
| 212 | /* ignore ReadError in reading a specific message and try to read as much as we can */ |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | void |
| 218 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::erasecxx . . $ pvpgn/bnetd/Mailbox#erase(cb2f890c2fdad230).(unsigned int idx) |
| 219 | { |
| 220 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 221 | const char* dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).(); |
| 222 | for (unsigned i = 0; i < idx && (dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).());) |
| 223 | if (dentry[0] != '.') ++i; |
| 224 | |
| 225 | if (!dentry) { |
| 226 | WARN0cxx . . $ `src/common/eventlog.h:78:9`!("index out of range"); |
| 227 | return; |
| 228 | } |
| 229 | |
| 230 | stdcxx . . $ std/::stringcxx . . $ std/string# fnamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 231 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '/'; |
| 232 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). dentry; |
| 233 | |
| 234 | if (stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).(fname.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()) < 0) |
| 235 | INFO2cxx . . $ `src/common/eventlog.h:85:9`!("could not remove file \"{}\" (std::remove: {})", fname.c_str(), std::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 236 | } |
| 237 | |
| 238 | void |
| 239 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::clearcxx . . $ pvpgn/bnetd/Mailbox#clear(49f6e7a06ebc5aa8).() |
| 240 | { |
| 241 | stdcxx . . $ std/::stringcxx . . $ std/string# fnamecxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).(pathcxx . . $ pvpgn/bnetd/Mailbox#path.); |
| 242 | fname +=cxx . . $ std/__cxx11/basic_string#`operator+=`(63cc1ae870623930). '/'; |
| 243 | |
| 244 | mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..rewindcxx . . $ pvpgn/Directory#rewind(49f6e7a06ebc5aa8).(); |
| 245 | |
| 246 | const char* dentry; |
| 247 | while ((dentry = mdircxx . . $ pvpgn/bnetd/Mailbox#mdir..readcxx . . $ pvpgn/Directory#read(a9f41ea0e82d88cf).())) { |
| 248 | stdcxx . . $ std/::removecxx . . $ std/remove(f5ecf3191ed0cd93).((fname +cxx . . $ std/operator+(40fc1db9226233c6). dentry).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | extern int handle_mail_commandcxx . . $ pvpgn/bnetd/handle_mail_command(2e9022cda97b266d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, char const * text) |
| 253 | { |
| 254 | if (!prefs_get_mail_supportcxx . . $ pvpgn/bnetd/prefs_get_mail_support(db52760e79bf9054).()) { |
| 255 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "This server has NO mail support.")); |
| 256 | return -1; |
| 257 | } |
| 258 | |
| 259 | char const *subcommand; |
| 260 | |
| 261 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> args = split_commandcxx . . $ pvpgn/bnetd/split_command(36641c1b5e9c088b).(text, 3); |
| 262 | if (args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).1].emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 263 | { |
| 264 | describe_commandcxx . . $ pvpgn/bnetd/describe_command(2e9022cda97b266d).(c, args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 265 | return -1; |
| 266 | } |
| 267 | subcommand = args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).1].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(); // subcommand |
| 268 | |
| 269 | switch (identify_mail_functioncxx . . $ pvpgn/bnetd/identify_mail_function(7787e0c995c81e02).(subcommandcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)) { |
| 270 | case MAIL_FUNC_SENDcxx . . $ `src/bnetd/mail.h:28:9`!: |
| 271 | if (args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).3].emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 272 | { |
| 273 | describe_commandcxx . . $ pvpgn/bnetd/describe_command(2e9022cda97b266d).(c, args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 274 | return -1; |
| 275 | } |
| 276 | mail_func_sendcxx . . $ pvpgn/bnetd/mail_func_send(eaaa44a2dcaaa0e3).(c, args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).3].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 277 | break; |
| 278 | case MAIL_FUNC_READcxx . . $ `src/bnetd/mail.h:29:9`!: |
| 279 | mail_func_readcxx . . $ pvpgn/bnetd/mail_func_read(e34d4e827966f3c4).(c, argscxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2]); |
| 280 | break; |
| 281 | case MAIL_FUNC_DELETEcxx . . $ `src/bnetd/mail.h:30:9`!: |
| 282 | if (args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2].emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) |
| 283 | { |
| 284 | describe_commandcxx . . $ pvpgn/bnetd/describe_command(2e9022cda97b266d).(c, args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 285 | return -1; |
| 286 | } |
| 287 | mail_func_deletecxx . . $ pvpgn/bnetd/mail_func_delete(e34d4e827966f3c4).(c, argscxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).2]); |
| 288 | break; |
| 289 | default: |
| 290 | describe_commandcxx . . $ pvpgn/bnetd/describe_command(2e9022cda97b266d).(c, args[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).0].c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 291 | } |
| 292 | |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | static int identify_mail_functioncxx . . $ pvpgn/bnetd/identify_mail_function(7787e0c995c81e02).(const stdcxx . . $ std/::stringcxx . . $ std/string#& funcstr) |
| 297 | { |
| 298 | if (funcstr.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).() || !strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "read") || !strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "r")) |
| 299 | return MAIL_FUNC_READcxx . . $ `src/bnetd/mail.h:29:9`!; |
| 300 | if (!strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "send") || !strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "s")) |
| 301 | return MAIL_FUNC_SENDcxx . . $ `src/bnetd/mail.h:28:9`!; |
| 302 | if (!strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "delete") || !strcasecmp(funcstr.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), "del")) |
| 303 | return MAIL_FUNC_DELETEcxx . . $ `src/bnetd/mail.h:30:9`!; |
| 304 | |
| 305 | return MAIL_FUNC_UNKNOWNcxx . . $ `src/bnetd/mail.h:31:9`!; |
| 306 | } |
| 307 | |
| 308 | static unsigned get_mail_quotacxx . . $ pvpgn/bnetd/get_mail_quota(c7ab9369555c44b8).(t_accountcxx . . $ pvpgn/bnetd/t_account# * user) |
| 309 | { |
| 310 | int quota; |
| 311 | char const * user_quota = account_get_strattrcxx . . $ `src/bnetd/account.h:96:9`!(user, "BNET\\auth\\mailquota"); |
| 312 | |
| 313 | if (!user_quota) quota = prefs_get_mail_quotacxx . . $ pvpgn/bnetd/prefs_get_mail_quota(db52760e79bf9054).(); |
| 314 | else { |
| 315 | quota = stdcxx . . $ std/::atoi(user_quota); |
| 316 | if (quota < 1) quota = 1; |
| 317 | if (quota > MAX_MAIL_QUOTAcxx . . $ `src/bnetd/mail.h:27:9`!) quota = MAX_MAIL_QUOTAcxx . . $ `src/bnetd/mail.h:27:9`!; |
| 318 | } |
| 319 | |
| 320 | return quota; |
| 321 | } |
| 322 | |
| 323 | static void mail_func_sendcxx . . $ pvpgn/bnetd/mail_func_send(eaaa44a2dcaaa0e3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, char const * receiver, char const * message) |
| 324 | { |
| 325 | if (!c) { |
| 326 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection"); |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | t_accountcxx . . $ pvpgn/bnetd/t_account# * recv = accountlist_find_accountcxx . . $ pvpgn/bnetd/accountlist_find_account(db6f5ebdea1fa12b).(receiver); |
| 331 | if (!recv) { |
| 332 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Receiver UNKNOWN!")); |
| 333 | return; |
| 334 | } |
| 335 | |
| 336 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox# mboxcxx . . $ pvpgn/bnetd/Mailbox#Mailbox(cb2f890c2fdad230).(account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(recv)); |
| 337 | if (get_mail_quotacxx . . $ pvpgn/bnetd/get_mail_quota(c7ab9369555c44b8).(recv) <= mbox.sizecxx . . $ pvpgn/bnetd/Mailbox#size(ddd8539a2fcdd4ce).()) { |
| 338 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Receiver has reached his mail quota. Your message will NOT be sent.")); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | try { |
| 343 | mbox.delivercxx . . $ pvpgn/bnetd/Mailbox#deliver(c3ca1c130ce09c52).(conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(c), messagecxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 344 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Your mail has been sent successfully.")); |
| 345 | } |
| 346 | catch (const Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::DeliverErrorcxx . . $ pvpgn/bnetd/Mailbox#DeliverError#&) { |
| 347 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "There was an error completing your request!")); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | bool NonNumericCharcxx . . $ pvpgn/bnetd/NonNumericChar(b5fd09639b7a0261).(const char ch) |
| 352 | { |
| 353 | if (ch < '0' || ch > '9') return true; |
| 354 | return false; |
| 355 | } |
| 356 | |
| 357 | static void mail_func_readcxx . . $ pvpgn/bnetd/mail_func_read(e34d4e827966f3c4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, stdcxx . . $ std/::stringcxx . . $ std/string# token) |
| 358 | { |
| 359 | if (!c) { |
| 360 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection"); |
| 361 | return; |
| 362 | } |
| 363 | |
| 364 | t_accountcxx . . $ pvpgn/bnetd/t_account# * user = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 365 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox# mboxcxx . . $ pvpgn/bnetd/Mailbox#Mailbox(cb2f890c2fdad230).(account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(user)); |
| 366 | |
| 367 | if (token.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { /* user wants to see the mail summary */ |
| 368 | if (mbox.emptycxx . . $ pvpgn/bnetd/Mailbox#empty(50ce9a9e25b4a850).()) { |
| 369 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "You have no mail.")); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | MailListcxx . . $ pvpgn/bnetd/MailList# mlistcxx . . $ std/deque#deque(49f6e7a06ebc5aa8).; |
| 374 | mbox.readAllcxx . . $ pvpgn/bnetd/Mailbox#readAll(ce7a057c2f96e783).(mlist); |
| 375 | |
| 376 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# ostrcxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 377 | ostr <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "You have " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). mbox.sizecxx . . $ pvpgn/bnetd/Mailbox#size(ddd8539a2fcdd4ce).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " messages. Your mail quote is set to " <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). get_mail_quotacxx . . $ pvpgn/bnetd/get_mail_quota(c7ab9369555c44b8).(user) <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). '.'; |
| 378 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 379 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "ID Sender Date")); |
| 380 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, "-------------------------------------"); |
| 381 | |
| 382 | for (MailListcxx . . $ pvpgn/bnetd/MailList#::const_iteratorcxx . . $ std/deque#const_iterator# itcxx . . $ std/_Deque_iterator#_Deque_iterator(5880d2d26bbc17a2).(mlist.begincxx . . $ std/deque#begin(3eee4dc5a9c66500).()); it !=cxx . . $ std/`operator!=`(152371cc16d20f0). mlist.endcxx . . $ std/deque#end(3eee4dc5a9c66500).(); ++cxx . . $ std/_Deque_iterator#operator++(b314c016dddee38f).it) { |
| 383 | ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(f82a3577bf86cf38).(""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).); |
| 384 | ostr <<cxx . . $ std/`operator<<`(47f1cf32aeb3f1a2). stdcxx . . $ std/::setfillcxx . . $ std/setfill(ade351e831a1374a).('0') <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(2) <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::rightcxx . . $ std/right(cf36cc481190cd1f). <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). (it -cxx . . $ std/operator-(bf36b75074b4bc73). mlist.begincxx . . $ std/deque#begin(3eee4dc5a9c66500).()) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " |
| 385 | <<cxx . . $ std/`operator<<`(47f1cf32aeb3f1a2). stdcxx . . $ std/::setfillcxx . . $ std/setfill(ade351e831a1374a).(' ') <<cxx . . $ std/`operator<<`(fe9a269018418773). stdcxx . . $ std/::setwcxx . . $ std/setw(f06ce2e9220601fb).(14) <<cxx . . $ std/basic_ostream#`operator<<`(d90e0e305b0e25c2). stdcxx . . $ std/::leftcxx . . $ std/left(cf36cc481190cd1f). <<cxx . . $ std/`operator<<`(88df5bef833f7f83). it->cxx . . $ std/_Deque_iterator#`operator->`(b3b305bdb114c302).sendercxx . . $ pvpgn/bnetd/Mail#sender(f4fff0029955a25f).() <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ' '; |
| 386 | char buff[128]; |
| 387 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(buff, sizeof(buff), "%a %b %d %H:%M:%S %Y", stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&it->cxx . . $ std/_Deque_iterator#`operator->`(b3b305bdb114c302).timestampcxx . . $ pvpgn/bnetd/Mail#timestamp(6a0f01c7459e4657).())); |
| 388 | ostr <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). buff; |
| 389 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 390 | } |
| 391 | |
| 392 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Use /mail read <ID> to read the content of any message")); |
| 393 | } |
| 394 | else { /* user wants to read a message */ |
| 395 | if (stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(token.begincxx . . $ std/__cxx11/basic_string#begin(417acd00ce8503f4).(), token.endcxx . . $ std/__cxx11/basic_string#end(417acd00ce8503f4).(), NonNumericCharcxx . . $ pvpgn/bnetd/NonNumericChar(b5fd09639b7a0261).) !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). token.endcxx . . $ std/__cxx11/basic_string#end(417acd00ce8503f4).()) { |
| 396 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Invalid index. Please use /mail read <index> where <index> is a number.")); |
| 397 | return; |
| 398 | } |
| 399 | |
| 400 | try { |
| 401 | unsigned idx = stdcxx . . $ std/::atoi(token.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 402 | Mailcxx . . $ pvpgn/bnetd/Mail# mail(mbox.readcxx . . $ pvpgn/bnetd/Mailbox#read(af5817b933df5210).(idx)); |
| 403 | |
| 404 | stdcxx . . $ std/::ostringstreamcxx . . $ std/ostringstream# ostrcxx . . $ std/__cxx11/basic_ostringstream#basic_ostringstream(49f6e7a06ebc5aa8).; |
| 405 | ostr <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Message #" <<cxx . . $ std/basic_ostream#`operator<<`(b4c055c363850233). idx <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " from " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). mail.sendercxx . . $ pvpgn/bnetd/Mail#sender(f4fff0029955a25f).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " on "; |
| 406 | char buff[128]; |
| 407 | stdcxx . . $ std/::strftimecxx . . $ std/strftime(689617e6f2fd1a9a).(buff, sizeof(buff), "%a %b %d %H:%M:%S %Y", stdcxx . . $ std/::localtimecxx . . $ std/localtime(7d91c9e5f6bb884b).(&mail.timestampcxx . . $ pvpgn/bnetd/Mail#timestamp(6a0f01c7459e4657).())); |
| 408 | ostr <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). buff <<cxx . . $ std/`operator<<`(dd93bb5737bfac24). ':'; |
| 409 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, ostr.strcxx . . $ std/__cxx11/basic_ostringstream#str(d33e1a6fd36255f7).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 410 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(61daf7e3ba1862c4).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, mail.messagecxx . . $ pvpgn/bnetd/Mail#message(f4fff0029955a25f).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 411 | } |
| 412 | catch (const Mailboxcxx . . $ pvpgn/bnetd/Mailbox#::ReadErrorcxx . . $ pvpgn/bnetd/Mailbox#ReadError#&) { |
| 413 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "There was an error completing your request.")); |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | static void mail_func_deletecxx . . $ pvpgn/bnetd/mail_func_delete(e34d4e827966f3c4).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, stdcxx . . $ std/::stringcxx . . $ std/string# token) |
| 419 | { |
| 420 | if (!c) { |
| 421 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection"); |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | if (token.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 426 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Please specify which message to delete. Use the following syntax: /mail delete {<index>|all} .")); |
| 427 | return; |
| 428 | } |
| 429 | |
| 430 | t_accountcxx . . $ pvpgn/bnetd/t_account# * user = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c); |
| 431 | Mailboxcxx . . $ pvpgn/bnetd/Mailbox# mboxcxx . . $ pvpgn/bnetd/Mailbox#Mailbox(cb2f890c2fdad230).(account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(user)); |
| 432 | |
| 433 | if (token ==cxx . . $ std/`operator==`(4b17aa87c9f300c6). "all") { |
| 434 | mbox.clearcxx . . $ pvpgn/bnetd/Mailbox#clear(49f6e7a06ebc5aa8).(); |
| 435 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Successfully deleted messages.")); |
| 436 | } |
| 437 | else { |
| 438 | if (stdcxx . . $ std/::find_ifcxx . . $ std/find_if(f0a0a4f94ee5cb00).(token.begincxx . . $ std/__cxx11/basic_string#begin(417acd00ce8503f4).(), token.endcxx . . $ std/__cxx11/basic_string#end(417acd00ce8503f4).(), NonNumericCharcxx . . $ pvpgn/bnetd/NonNumericChar(b5fd09639b7a0261).) !=cxx . . $ __gnu_cxx/`operator!=`(30ee64f2df4eef8b). token.endcxx . . $ std/__cxx11/basic_string#end(417acd00ce8503f4).()) { |
| 439 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_errorcxx . . $ pvpgn/bnetd/message_type_error., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Invalid index. Please use /mail delete {<index>|all} where <index> is a number.")); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | mbox.erasecxx . . $ pvpgn/bnetd/Mailbox#erase(cb2f890c2fdad230).(stdcxx . . $ std/::atoi(token.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).())); |
| 444 | message_send_textcxx . . $ pvpgn/bnetd/message_send_text(6288036871507e5c).(c, message_type_infocxx . . $ pvpgn/bnetd/message_type_info., c, localizecxx . . $ `src/bnetd/i18n.h:73:11`!(c, "Succesfully deleted message.")); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | |
| 449 | extern unsigned check_mailcxx . . $ pvpgn/bnetd/check_mail(8bd2285a65940781).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# const * c) |
| 450 | { |
| 451 | if (!c) { |
| 452 | ERROR0cxx . . $ `src/common/eventlog.h:73:9`!("got NULL connection"); |
| 453 | return 0; |
| 454 | } |
| 455 | |
| 456 | if (t_accountcxx . . $ pvpgn/bnetd/t_account# * account = conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(c)) |
| 457 | return Mailboxcxx . . $ pvpgn/bnetd/Mailbox#(account_get_uidcxx . . $ `src/bnetd/account.h:91:9`!(account)).sizecxx . . $ pvpgn/bnetd/Mailbox#size(ddd8539a2fcdd4ce).(); |
| 458 | |
| 459 | return 0; |
| 460 | } |
| 461 | |
| 462 | } |
| 463 | |
| 464 | } |