summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-12-28 22:52:46 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-12-28 22:52:46 +0000
commit5598bed42b6b8a04f8faedb2e75b4ee7479b242a (patch)
tree03e5495699b49edbfb5a3a384cd5f6d3657091b9
parent205579c3be58537060785d174f9f67c89444a21b (diff)
downloadmanaserv-5598bed42b6b8a04f8faedb2e75b4ee7479b242a.tar.gz
manaserv-5598bed42b6b8a04f8faedb2e75b4ee7479b242a.tar.bz2
manaserv-5598bed42b6b8a04f8faedb2e75b4ee7479b242a.tar.xz
manaserv-5598bed42b6b8a04f8faedb2e75b4ee7479b242a.zip
Integrated the building of tmwclient with the default make command, as
contributed by r0nny.
-rw-r--r--ChangeLog10
-rwxr-xr-xmakeclient.sh4
-rw-r--r--src/Makefile.am154
-rw-r--r--src/dalstorage.cpp74
-rw-r--r--src/dalstorage.h2
-rw-r--r--src/storage.h8
-rw-r--r--src/utils/logger.h6
7 files changed, 134 insertions, 124 deletions
diff --git a/ChangeLog b/ChangeLog
index d2df972c..a21bb930 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-28 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * makeclient.sh, src/Makefile.am: Integrated the building of tmwclient
+ with the default make command, as contributed by r0nny.
+
2005-12-27 Yohann Ferreira <bertram@cegetel.net>
* src/chathandler.h, src/chathandler.cpp, src/defines.h,
@@ -9,7 +14,7 @@
needs to be implemented. Added a small slangs filter to reduce bad
words in account names and in conversations a little.
-2005-12-26 Bjorn Lindeijer <bjorn@lindeijer.nl>
+2005-12-26 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/storage.cpp: Removed manual throwing of std::bad_alloc, which
should happen by default unless new(nothrow) is used. Suggested by
@@ -67,6 +72,7 @@
Added unregistering, checking on character's name and email
length support. Also made some little tweaks.
+>>>>>>> 1.25
2005-12-10 Yohann Ferreira <bertram@cegetel.net>
* src/dalstorage.cpp: Fixed the buggy part of getAccount()
@@ -85,7 +91,7 @@
* src/dalstorage.cpp, src/dalstorage.h, src/storage.h:
Radically improve the getEmailList() again based on
- MrLindejer's good idea.
+ MrLindeijer's good idea.
* src/accounthandler.cpp: Simplify the code of Email check
based on the previous improvement.
diff --git a/makeclient.sh b/makeclient.sh
deleted file mode 100755
index 72c4f50f..00000000
--- a/makeclient.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-g++ -I/usr/include/SDL -D_REENTRANT -o client \
- src/client.cpp src/messageout.cpp src/packet.cpp \
- -L/usr/lib -lSDL_net -lSDL -lpthread
diff --git a/src/Makefile.am b/src/Makefile.am
index ad8c046e..a9dd5cde 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,97 +1,103 @@
# $Id$
+bin_PROGRAMS = tmwclient tmwserv
-bin_PROGRAMS = tmwserv
+tmwclient_SOURCES = client.cpp \
+ defines.h \
+ messageout.h \
+ messageout.cpp \
+ packet.h \
+ packet.cpp
tmwserv_SOURCES = main.cpp \
- configuration.h \
- configuration.cpp \
- accounthandler.h \
- accounthandler.cpp \
- chathandler.h \
- chathandler.cpp \
- connectionhandler.h \
- connectionhandler.cpp \
- gamehandler.h \
- gamehandler.cpp \
- state.h \
- state.cpp \
- debug.h \
- debug.cpp \
- defines.h \
- items.h \
- items.cpp \
- map.cpp \
- map.h \
- mapmanager.h \
- mapmanager.cpp \
- mapreader.cpp \
- mapreader.h \
- messagehandler.h \
- messagehandler.cpp \
- messagein.h \
- messagein.cpp \
- messageout.h \
- messageout.cpp \
- netcomputer.h \
- netcomputer.cpp \
- netsession.h \
- netsession.cpp \
- packet.h \
- packet.cpp \
- skill.h \
- skill.cpp \
- resourcemanager.cpp \
- resourcemanager.h \
- storage.h \
- storage.cpp \
- account.h \
- account.cpp \
- object.h \
- object.cpp \
- being.h \
- being.cpp \
- dalstorage.h \
- dalstorage.cpp \
- dal/dalexcept.h \
- dal/dataprovider.h \
- dal/dataprovider.cpp \
- dal/dataproviderfactory.h \
- dal/dataproviderfactory.cpp \
- dal/recordset.h \
- dal/recordset.cpp \
- utils/base64.h \
- utils/base64.cpp \
- utils/countedptr.h \
- utils/functors.h \
- utils/singleton.h \
- utils/cipher.h \
- utils/cipher.cpp \
- utils/logger.h \
- utils/logger.cpp \
- utils/slangsfilter.h \
- utils/slangsfilter.cpp
+ configuration.h \
+ configuration.cpp \
+ accounthandler.h \
+ accounthandler.cpp \
+ chathandler.h \
+ chathandler.cpp \
+ connectionhandler.h \
+ connectionhandler.cpp \
+ gamehandler.h \
+ gamehandler.cpp \
+ state.h \
+ state.cpp \
+ debug.h \
+ debug.cpp \
+ defines.h \
+ items.h \
+ items.cpp \
+ map.cpp \
+ map.h \
+ mapmanager.h \
+ mapmanager.cpp \
+ mapreader.cpp \
+ mapreader.h \
+ messagehandler.h \
+ messagehandler.cpp \
+ messagein.h \
+ messagein.cpp \
+ messageout.h \
+ messageout.cpp \
+ netcomputer.h \
+ netcomputer.cpp \
+ netsession.h \
+ netsession.cpp \
+ packet.h \
+ packet.cpp \
+ skill.h \
+ skill.cpp \
+ resourcemanager.cpp \
+ resourcemanager.h \
+ storage.h \
+ storage.cpp \
+ account.h \
+ account.cpp \
+ object.h \
+ object.cpp \
+ being.h \
+ being.cpp \
+ dalstorage.h \
+ dalstorage.cpp \
+ dal/dalexcept.h \
+ dal/dataprovider.h \
+ dal/dataprovider.cpp \
+ dal/dataproviderfactory.h \
+ dal/dataproviderfactory.cpp \
+ dal/recordset.h \
+ dal/recordset.cpp \
+ utils/base64.h \
+ utils/base64.cpp \
+ utils/countedptr.h \
+ utils/functors.h \
+ utils/singleton.h \
+ utils/cipher.h \
+ utils/cipher.cpp \
+ utils/logger.h \
+ utils/logger.cpp \
+ utils/slangsfilter.h \
+ utils/slangsfilter.cpp
if BUILD_MYSQL
tmwserv_SOURCES += dal/mysqldataprovider.h \
- dal/mysqldataprovider.cpp
+ dal/mysqldataprovider.cpp
endif
if BUILD_POSTGRESQL
tmwserv_SOURCES += dal/pqdataprovider.h \
- dal/pqdataprovider.cpp
+ dal/pqdataprovider.cpp
endif
if BUILD_SQLITE
tmwserv_SOURCES += dal/sqlitedataprovider.h \
- dal/sqlitedataprovider.cpp
+ dal/sqlitedataprovider.cpp
endif
if BUILD_SQUIRREL
tmwserv_SOURCES += script.h \
- script.cpp \
- script-squirrel.h \
- script-squirrel.cpp
+ script.cpp \
+ script-squirrel.h \
+ script-squirrel.cpp
endif
if BUILD_RUBY
diff --git a/src/dalstorage.cpp b/src/dalstorage.cpp
index fc3a70d9..5723a040 100644
--- a/src/dalstorage.cpp
+++ b/src/dalstorage.cpp
@@ -20,7 +20,6 @@
* $Id$
*/
-
#include <sstream>
#include <vector>
@@ -66,7 +65,7 @@ DALStorage::~DALStorage()
void
DALStorage::open(void)
{
- // do nothing if already connected.
+ // Do nothing if already connected.
if (mDb->isConnected()) {
return;
}
@@ -379,6 +378,7 @@ DALStorage::getEmailList()
open();
std::list <std::string> emailList;
+
try {
std::string sql("select email from ");
sql += ACCOUNTS_TBL_NAME;
@@ -390,16 +390,16 @@ DALStorage::getEmailList()
if (accountInfo.isEmpty()) {
return emailList;
}
- for (unsigned int i = 0; i < accountInfo.rows(); i++)
- {
- // We add all these addresses to the list
- emailList.push_front(accountInfo(i, 0));
- }
+ for (unsigned int i = 0; i < accountInfo.rows(); i++)
+ {
+ // We add all these addresses to the list
+ emailList.push_front(accountInfo(i, 0));
}
- catch (const dal::DbSqlQueryExecFailure& e) {
+ }
+ catch (const dal::DbSqlQueryExecFailure& e) {
// TODO: throw an exception.
- LOG_ERROR("SQL query failure: " << e.what(), 0)
- }
+ LOG_ERROR("SQL query failure: " << e.what(), 0);
+ }
return emailList;
}
@@ -408,41 +408,39 @@ DALStorage::getEmailList()
* Tells if Email already exists.
*/
bool
-DALStorage::doesEmailAlreadyExists(std::string email)
+DALStorage::doesEmailAlreadyExists(const std::string &email)
{
// If not opened already
open();
try {
- std::string sql("select count(email) from ");
- sql += ACCOUNTS_TBL_NAME;
- sql += " where upper(email) = upper('";
- sql += email;
- sql += "');";
- const dal::RecordSet& accountInfo = mDb->execSql(sql);
-
- // if the account is empty then
- // we have no choice but to return false.
- if (accountInfo.isEmpty()) {
- return false;
- }
-
- std::stringstream ssStream(accountInfo(0,0));
- int iReturn = -1;
- ssStream >> iReturn;
- if ( iReturn > 0 )
- {
- return true;
- }
- else
- {
- return false;
- }
+ std::string sql("select count(email) from ");
+ sql += ACCOUNTS_TBL_NAME;
+ sql += " where upper(email) = upper('" + email + "');";
+
+ const dal::RecordSet& accountInfo = mDb->execSql(sql);
+
+ // If the account is empty then we have no choice but to return false.
+ if (accountInfo.isEmpty()) {
+ return false;
}
- catch (const dal::DbSqlQueryExecFailure& e) {
- // TODO: throw an exception.
- LOG_ERROR("SQL query failure: " << e.what(), 0)
+
+ std::stringstream ssStream(accountInfo(0,0));
+ int iReturn = -1;
+ ssStream >> iReturn;
+ if ( iReturn > 0 )
+ {
+ return true;
}
+ else
+ {
+ return false;
+ }
+ }
+ catch (const dal::DbSqlQueryExecFailure& e) {
+ // TODO: throw an exception.
+ LOG_ERROR("SQL query failure: " << e.what(), 0);
+ }
return false;
}
diff --git a/src/dalstorage.h b/src/dalstorage.h
index 6e3eb7fb..af109dc2 100644
--- a/src/dalstorage.h
+++ b/src/dalstorage.h
@@ -104,7 +104,7 @@ class DALStorage: public Storage
* @return true if Email is already in database
*/
bool
- doesEmailAlreadyExists(std::string email);
+ doesEmailAlreadyExists(const std::string &email);
/**
* Tells if the character's name already exists
diff --git a/src/storage.h b/src/storage.h
index 3ee59e70..6381fea7 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -283,6 +283,10 @@ class Storage
/**
* Get the list of Emails in the accounts list.
* @return the list of Email's Addresses.
+ *
+ * @deprecated The only purpose of using this list inside the server is
+ * for checking for existing email addresses, which is
+ * covered by Storage::doesEmailAlreadyExists().
*/
virtual
std::list<std::string> getEmailList() = 0;
@@ -291,8 +295,8 @@ class Storage
* Return if an Email is already in account's table.
* @return true if Email already exists.
*/
- virtual
- bool doesEmailAlreadyExists(std::string email) = 0;
+ virtual bool
+ doesEmailAlreadyExists(const std::string &email) = 0;
/**
* Tells if the character's name already exists
diff --git a/src/utils/logger.h b/src/utils/logger.h
index f730600b..75c86593 100644
--- a/src/utils/logger.h
+++ b/src/utils/logger.h
@@ -53,8 +53,8 @@ namespace utils
*
* Example of use:
*
- * <code>
- * #include "logger.h"
+ * <pre>
+ * \#include "logger.h"
*
* int main(void)
* {
@@ -85,7 +85,7 @@ namespace utils
*
* return 0;
* }
- * </code>
+ * </pre>
*/
class Logger: public Singleton<Logger>
{