Remove all mention of MySQL database

This commit is contained in:
moyamo 2015-12-02 23:06:56 +02:00
parent c44baf892d
commit 17c8057db7
5 changed files with 5 additions and 18 deletions

View File

@ -10,7 +10,6 @@ transWhat is a WhatsApp XMPP Gateway based on [Spectrum 2](http://www.spectrum.i
- **e4u**: is a simple emoji4unicode python bindings
- [**yowsup**](https://github.com/tgalal/yowsup): is a python library that enables you build application which use WhatsApp service.
- **mysqldb**: MySQL client python bindings
#### Spectrum 2
is a XMPP transport

View File

@ -22,13 +22,8 @@ __status__ = "Prototype"
along with transWhat. If not, see <http://www.gnu.org/licenses/>.
"""
DB_HOST = "localhost"
DB_USER = ""
DB_PASS = ""
DB_TABLE = "transwhat"
BASE_PATH = "/opt/transwhat"
TOKEN_FILE = BASE_PATH + "/logs/tokens"
MOTD_FILE = BASE_PATH + "/conf/motd"
REQUESTS_FILE = BASE_PATH + "/logs/requests"
REQUESTS_FILE = BASE_PATH + "/logs/requests"

View File

@ -28,7 +28,6 @@ import urllib
import time
from PIL import Image
import MySQLdb
import sys
import os
@ -57,14 +56,11 @@ class MsgIDs:
class Session(YowsupApp):
def __init__(self, backend, user, legacyName, extra, db):
def __init__(self, backend, user, legacyName, extra):
super(Session, self).__init__()
self.logger = logging.getLogger(self.__class__.__name__)
self.logger.info("Created: %s", legacyName)
#self.db = db
self.db = MySQLdb.connect(DB_HOST, DB_USER, DB_PASS, DB_TABLE)
self.backend = backend
self.user = user
self.legacyName = legacyName

View File

@ -29,7 +29,6 @@ import traceback
import logging
import asyncore
import sys, os
import MySQLdb
import e4u
import threading
import Queue
@ -75,10 +74,9 @@ def connectionClosed():
closed = True
# Main
db = MySQLdb.connect(DB_HOST, DB_USER, DB_PASS, DB_TABLE)
io = IOChannel(args.host, args.port, handleTransportData, connectionClosed)
plugin = WhatsAppBackend(io, db, args.j)
plugin = WhatsAppBackend(io, args.j)
plugin.handleBackendConfig('features', 'send_buddies_on_login', 1)

View File

@ -30,11 +30,10 @@ from session import Session
import logging
class WhatsAppBackend(SpectrumBackend):
def __init__(self, io, db, spectrum_jid):
def __init__(self, io, spectrum_jid):
SpectrumBackend.__init__(self)
self.logger = logging.getLogger(self.__class__.__name__)
self.io = io
self.db = db
self.sessions = { }
self.spectrum_jid = spectrum_jid
# Used to prevent duplicate messages
@ -46,7 +45,7 @@ class WhatsAppBackend(SpectrumBackend):
def handleLoginRequest(self, user, legacyName, password, extra):
self.logger.debug("handleLoginRequest(user=%s, legacyName=%s)", user, legacyName)
if user not in self.sessions:
self.sessions[user] = Session(self, user, legacyName, extra, self.db)
self.sessions[user] = Session(self, user, legacyName, extra)
if user not in self.lastMessage:
self.lastMessage[user] = {}