Changeset - db6f7e6c8f86
[Not reviewed]
0 3 0
HanzZ - 13 years ago 2012-02-15 20:48:51
hanzz.k@gmail.com
sending sms works
3 files changed with 24 insertions and 4 deletions:
0 comments (0 inline, 0 general)
backends/CMakeLists.txt
Show inline comments
 
@@ -7,7 +7,7 @@ if (PROTOBUF_FOUND)
 
		ADD_SUBDIRECTORY(libcommuni)
 
	endif()
 

	
 
#ADD_SUBDIRECTORY(smstools3)
 
	ADD_SUBDIRECTORY(smstools3)
 

	
 
if (NOT WIN32)
 
	ADD_SUBDIRECTORY(frotz)
backends/smstools3/main.cpp
Show inline comments
 
@@ -87,6 +87,8 @@ class SMSNetworkPlugin : public NetworkPlugin {
 
				str = str.substr(str.find("\n") + 1);
 
			}
 

	
 
			std::cout << "INCOMING SMS '" << to << "' '" << msg << "'\n";
 

	
 
		}
 

	
 
		void handleSMSDir() {
 
@@ -97,7 +99,7 @@ class SMSNetworkPlugin : public NetworkPlugin {
 
				try {
 
					if (is_regular(itr->path())) {
 
						handleSMS(itr->path().string());
 
						remove(itr->path());
 
//						remove(itr->path());
 
					}
 
				}
 
				catch (const filesystem_error& ex) {
 
@@ -107,6 +109,22 @@ class SMSNetworkPlugin : public NetworkPlugin {
 
			m_timer->start();
 
		}
 

	
 
		void sendSMS(const std::string &to, const std::string &msg) {
 
			std::string data = "To: " + to + "\n";
 
			data += "\n";
 
			data += msg;
 

	
 
			std::string bucket = "abcdefghijklmnopqrstuvwxyz";
 
			std::string uuid;
 
			for (int i = 0; i < 10; i++) {
 
				uuid += bucket[rand() % bucket.size()];
 
			}
 
			std::ofstream myfile;
 
			myfile.open (std::string("/var/spool/sms/outgoing/spectrum." + uuid).c_str());
 
			myfile << data;
 
			myfile.close();
 
		}
 

	
 
		void sendData(const std::string &string) {
 
			m_conn->write(Swift::createSafeByteArray(string));
 
		}
 
@@ -127,7 +145,7 @@ class SMSNetworkPlugin : public NetworkPlugin {
 
		}
 

	
 
		void handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &xhtml = "") {
 

	
 
			sendSMS(legacyName, message);
 
		}
 

	
 
		void handleJoinRoomRequest(const std::string &user, const std::string &room, const std::string &nickname, const std::string &password) {
spectrum/src/sample.cfg
Show inline comments
 
@@ -13,7 +13,8 @@ admin_password=test
 
#cert=server.pfx #patch to PKCS#12 certificate
 
#cert_password=test #password to that certificate if any
 
users_per_backend=10
 
backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_libpurple_backend
 
#backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_libpurple_backend
 
backend=/home/hanzz/code/libtransport/backends/smstools3/spectrum2_smstools3_backend
 
#backend=/usr/bin/mono /home/hanzz/code/networkplugin-csharp/msnp-sharp-backend/bin/Debug/msnp-sharp-backend.exe
 
#backend=/home/hanzz/code/libtransport/backends/frotz/spectrum2_frotz_backend
 
#backend=/home/hanzz/code/libtransport/backends/libircclient-qt/spectrum2_libircclient-qt_backend
 
@@ -25,6 +26,7 @@ irc_server=irc.freenode.org
 
[backend]
 
#default_avatar=catmelonhead.jpg
 
#no_vcard_fetch=true
 
incoming_dir=/var/spool/sms/incoming
 

	
 
[logging]
 
#config=logging.cfg # log4cxx/log4j logging configuration file
0 comments (0 inline, 0 general)