Esempio n. 1
0
	def __init__(self,jid,message_id,url,mediaType_id,mediaId,account,resize=False):
		
		WADebug.attach(self);
		path = self.getSavePath(mediaType_id);
		
		filename = url.split('/')[-1]
		
		if path is None:
			raise Exception("Unknown media type")
		
		if not os.path.exists(path):
			os.makedirs(path)
		
		
		self.uploadHandler = MediaUploader(jid, account, self.onUploadSuccess, self.onError, self.onProgressUpdated)
		self.downloadHandler = MediaDownloader(self.onDownloadSuccess, self.onError, self.onProgressUpdated)

		self.url = url
		self._path = path+"/"+filename

		ext = os.path.splitext(filename)[1]

		self.downloadPath = Utilities.getUniqueFilename(path + "/" + self.getFilenamePrefix(mediaType_id) + ext)

		self.resize = resize
		self.mediaId = mediaId
		self.message_id = message_id
		self.jid = jid

		super(WAMediaHandler,self).__init__();
Esempio n. 2
0
	def __init__(self,store,userid):
		WADebug.attach(self);
		self.store = store;
		self.uid = userid;
		self.base_url = "sro.whatsapp.net";
		self.req_file = "/client/iphone/bbq.php";
		super(ContactsSyncer,self).__init__();
Esempio n. 3
0
    def __init__(self,
                 jid,
                 message_id,
                 url,
                 mediaType_id,
                 mediaId,
                 account,
                 resize=False):

        WADebug.attach(self)
        path = self.getSavePath(mediaType_id)

        filename = url.split('/')[-1]

        if path is None:
            raise Exception("Unknown media type")

        if not os.path.exists(path):
            os.makedirs(path)

        self.httpHandler = WAHTTPHandler(jid, account, mediaId, resize, url,
                                         path + "/" + filename)
        self.httpHandler.progressUpdated.connect(self.onProgressUpdated)
        self.httpHandler.success.connect(self.onSuccess)
        self.httpHandler.error.connect(self.onError)

        self.mediaId = mediaId
        self.message_id = message_id
        self.jid = jid

        super(WAMediaHandler, self).__init__()
Esempio n. 4
0
	def __init__(self,domain,resource,user,push_name,password):
		
		WADebug.attach(self);
		
		self.domain = domain;
		self.resource = resource;
		self.user=user;
		self.push_name=push_name;
		self.password = password;
		self.jid = user+'@'+domain
		self.fromm = user+'@'+domain+'/'+resource;
		self.supports_receipt_acks = False;
		self.msg_id = 0;
		self.state = 0 #0 disconnected 1 connecting 2 connected
		self.retry = True
		self.eventHandler = WAEventHandler(self);
		self.conn =MySocketConnection();		
		self.stanzaReader = None
		self.login = None;
		
		self.disconnectRequested = False
		
		self.connTries = 0;
		
		self.verbose = True
		self.iqId = 0;
		self.lock = threading.Lock()
		
		self.waiting = 0;
		
		#super(WAXMPP,self).__init__();
		
		self.eventHandler.initialConnCheck();
Esempio n. 5
0
	def __init__(self,conn):
		
		WADebug.attach(self);
		self.conn = conn;
		super(WAEventHandler,self).__init__();
		
		self.notifier = Notifier();
		self.connMonitor = ConnMonitor();
		
		self.connMonitor.connected.connect(self.networkAvailable);
		self.connMonitor.disconnected.connect(self.networkDisconnected);
		
		

		
		#self.connMonitor.sleeping.connect(self.networkUnavailable);
		#self.connMonitor.checked.connect(self.checkConnection);
		
		self.mediaHandlers = []
		self.sendTyping.connect(self.conn.sendTyping);
		self.sendPaused.connect(self.conn.sendPaused);
		self.getLastOnline.connect(self.conn.getLastOnline);
		
		self.connected.connect(self.conn.resendUnsent);
		
		self.pingTimer = QTimer();
		self.pingTimer.timeout.connect(self.sendPing)
		self.pingTimer.start(180000);
Esempio n. 6
0
    def __init__(self, accountId=0):
        super(RegistrationUI, self).__init__()
        WADebug.attach(self)

        YowsupDebugger.enabled = True
        self.deviceIMEI = Utilities.getImei()
        self.account = None  #waccount
        self.accountInstance = None  #real account
        self.smsHandler = None
        self.number = ""
        self.cc = ""

        self.gotAccountData.connect(self.createOrUpdateAccount)
        #AccountsManager.manager.accountCreated.connect(self.onAccountCreated)

        if accountId:
            account = AccountsManager.getAccountById(accountId)
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                raise Exception("Got account Id but couldn't find account")
        else:

            #this is a new account request
            #check existence of an old one
            account = AccountsManager.findAccount()
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                self.setupNewMode()

        src = QUrl('/opt/waxmppplugin/bin/wazapp/UI/Registration/regmain.qml')
        self.setSource(src)

        self.registrationFailed.connect(self.rootObject().onRegistrationFailed)
        self.registrationSuccess.connect(
            self.rootObject().onRegistrationSuccess)
        self.voiceCodeRequested.connect(self.rootObject().onVoiceCodeRequested)
        self.statusUpdated.connect(self.rootObject().onStatusUpdated)
        self.verificationSuccess.connect(self.rootObject().onVerifySuccess)
        self.verificationFailed.connect(self.rootObject().onVerifyFailed)

        self.rootObject().savePushName.connect(self.savePushname)
        self.rootObject().abraKadabra.connect(self.abraKadabra)
        self.rootObject().codeRequest.connect(self.codeRequest)
        #self.rootObject().stopCodeRequest.connect(self.stopCodeRequest)
        self.rootObject().registerRequest.connect(self.registerRequest)
        self.rootObject().deleteAccount.connect(self.deleteAccount)
        self.rootObject().verifyAccount.connect(self.existsRequest)
Esempio n. 7
0
	def __init__(self,connection):
		WADebug.attach(self);
		
		self.connection = connection
		self.inn = connection.inn;
		self.eventHandler = None;
		self.groupEventHandler = None;
		super(StanzaReader,self).__init__();
		self.requests = {};
Esempio n. 8
0
    def __init__(self, accountId = 0):
        super(RegistrationUI, self).__init__()
        WADebug.attach(self)
        
        YowsupDebugger.enabled = True
        self.deviceIMEI = Utilities.getImei()
        self.account = None #waccount
        self.accountInstance = None #real account
        self.smsHandler = None
        self.number = ""
        self.cc = ""
        
        self.gotAccountData.connect(self.createOrUpdateAccount)
        #AccountsManager.manager.accountCreated.connect(self.onAccountCreated)
        
        if accountId:
            account = AccountsManager.getAccountById(accountId)
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                raise Exception("Got account Id but couldn't find account")
        else:
            
            #this is a new account request
            #check existence of an old one 
            account = AccountsManager.findAccount()
            if account:
                self.account = account
                self.cc = account.cc
                self.number = account.phoneNumber
                self.accountInstance = account.accountInstance
                self.setupEditMode()
            else:
                self.setupNewMode()

        src = QUrl('/opt/waxmppplugin/bin/wazapp/UI/Registration/regmain.qml')
        self.setSource(src)

        self.registrationFailed.connect(self.rootObject().onRegistrationFailed)
        self.registrationSuccess.connect(self.rootObject().onRegistrationSuccess)
        self.voiceCodeRequested.connect(self.rootObject().onVoiceCodeRequested)
        self.statusUpdated.connect(self.rootObject().onStatusUpdated)
        self.verificationSuccess.connect(self.rootObject().onVerifySuccess)
        self.verificationFailed.connect(self.rootObject().onVerifyFailed)

        self.rootObject().savePushName.connect(self.savePushname)
        self.rootObject().abraKadabra.connect(self.abraKadabra)
        self.rootObject().codeRequest.connect(self.codeRequest)
        #self.rootObject().stopCodeRequest.connect(self.stopCodeRequest)
        self.rootObject().registerRequest.connect(self.registerRequest)
        self.rootObject().deleteAccount.connect(self.deleteAccount)
        self.rootObject().verifyAccount.connect(self.existsRequest)
Esempio n. 9
0
    def __init__(self, conn, reader, writer, digest):
        super(WALogin, self).__init__()

        WADebug.attach(self)

        self.conn = conn
        self.out = writer
        self.inn = reader
        self.digest = digest

        self._d("WALOGIN INIT")
Esempio n. 10
0
	def __init__(self,conn,reader,writer,digest):
		super(WALogin,self).__init__();
		
		WADebug.attach(self);
		
		self.conn = conn
		self.out = writer;
		self.inn = reader;
		self.digest = digest;
		
		self._d("WALOGIN INIT");
Esempio n. 11
0
	def __init__(self,conn):
		
		WADebug.attach(self);
		self.conn = conn;
		super(WAEventHandler,self).__init__();
		
		self.notifier = Notifier();
		self.connMonitor = ConnMonitor();
		
		self.connMonitor.connected.connect(self.networkAvailable);
		self.connMonitor.disconnected.connect(self.networkDisconnected);
		
		self.account = "";

		self.blockedContacts = "";

		self.resizeImages = False;
		self.disconnectRequested = False

		#self.interfaceHandler = LibInterfaceHandler()
		
		self.jid = self.conn.jid
		
		self.username = self.jid.split('@')[0]

		self.interfaceHandler = LibInterfaceHandler(self.username)
		self.registerInterfaceSignals()
		
		self.interfaceVersion = self.interfaceHandler.call("getVersion")
		
		self._d("Using Yowsup version %s"%self.interfaceVersion)

		
		self.listJids = [];

		self.mediaHandlers = []
		self.sendTyping.connect(lambda *args: self.interfaceHandler.call("typing_send", args));
		self.sendPaused.connect(lambda *args: self.interfaceHandler.call("typing_paused",args));
		self.getLastOnline.connect(lambda *args: self.interfaceHandler.call("presence_request", args));
		self.getGroupInfo.connect(lambda *args: self.interfaceHandler.call("group_getInfo", args));
		self.createGroupChat.connect(lambda *args: self.interfaceHandler.call("group_create", args));
		self.addParticipants.connect(lambda *args: self.interfaceHandler.call("group_addParticipants", args));
		self.removeParticipants.connect(lambda *args: self.interfaceHandler.call("group_removeParticipants", args));
		self.getGroupParticipants.connect(lambda *args: self.interfaceHandler.call("group_getParticipants", args));
		self.endGroupChat.connect(lambda *args: self.interfaceHandler.call("group_end", args));
		self.setGroupSubject.connect(lambda jid, subject: self.interfaceHandler.call("group_setSubject", (jid, self.strip(subject))));
		self.getPictureIds.connect(lambda *args: self.interfaceHandler.call("picture_getIds", args));
		self.changeStatus.connect(lambda status: self.interfaceHandler.call("profile_setStatus", (self.strip(status),)));

		self.state = 0
Esempio n. 12
0
    def __init__(self, app):
        self.app = app
        WADebug.attach(self)

        self._d("wazapp %s" % Utilities.waversion)

        try:
            bus = dbus.SessionBus()
            remote_object = bus.get_object("com.tgalal.meego.Wazapp.WAService", "/")
            self._d("Found a running instance. I will show it instead of relaunching.")
            remote_object.show()
            sys.exit()
        except dbus.exceptions.DBusException as e:
            self._d("No running instance found. Proceeding with relaunch")
            self.proceed()
Esempio n. 13
0
	def __init__(self,store,mode,userid):
		WADebug.attach(self);
		self.store = store;
		self.mode = mode
		self.uid = userid;
		self.parts = []
		self.cn = ""
		if mode == "SYNC":
			c = WAContacts(self.store);
			phoneContacts = c.getPhoneContacts();
			for c in phoneContacts:
				for number in c[2]:
					self.cn = self.cn + str(number) + ","
			self.parts = self.cn.split(',')
		self.base_url = "sro.whatsapp.net";
		self.req_file = "/client/iphone/bbq.php";
		super(ContactsSyncer,self).__init__();
Esempio n. 14
0
    def __init__(self, app):
        self.app = app
        WADebug.attach(self)

        self._d("wazapp %s" % Utilities.waversion)

        try:
            bus = dbus.SessionBus()
            remote_object = bus.get_object("com.tgalal.meego.Wazapp.WAService",
                                           "/")
            self._d(
                "Found a running instance. I will show it instead of relaunching."
            )
            remote_object.show()
            sys.exit()
        except dbus.exceptions.DBusException as e:
            self._d("No running instance found. Proceeding with relaunch")
            self.proceed()
Esempio n. 15
0
	def __init__(self,store, contactsManager, mode,userid = None):
		WADebug.attach(self);
		self.store = store;
		self.mode = mode
		self.uid = userid;
		
		super(ContactsSyncer,self).__init__();
		
		acc = AccountsManager.getCurrentAccount();
		
		if not acc:
			self.contactsRefreshFail.emit()
			
		
		username = str(acc.username)
		password = acc.password
		
		self.contactsManager = contactsManager
			
		self.syncer = WAContactsSyncRequest(username, password, [])	
Esempio n. 16
0
 def __init__(self, store, mode, userid):
     WADebug.attach(self)
     self.store = store
     self.mode = mode
     self.uid = userid
     self.parts = []
     self.cn = ""
     if mode == "SYNC":
         c = WAContacts(self.store)
         phoneContacts = c.getPhoneContacts()
         for c in phoneContacts:
             for number in c[2]:
                 try:
                     self.cn = self.cn + str(number) + ","
                 except UnicodeEncodeError:
                     continue
         self.parts = self.cn.split(",")
     self.base_url = "sro.whatsapp.net"
     self.req_file = "/client/iphone/bbq.php"
     super(ContactsSyncer, self).__init__()
Esempio n. 17
0
	def __init__(self,jid,message_id,url,mediaType_id,account,resize=False):
		
		WADebug.attach(self);
		path = self.getSavePath(mediaType_id);
		
		filename = url.split('/')[-1]
		
		if path is None:
			raise Exception("Unknown media type")
		
		if not os.path.exists(path):
			os.makedirs(path)
		
		self.httpHandler = WAHTTPHandler(jid,account,resize,url,path+"/"+filename)
		self.httpHandler.progressUpdated.connect(self.onProgressUpdated)
		self.httpHandler.success.connect(self.onSuccess)
		self.httpHandler.error.connect(self.onError)
		
		self.message_id = message_id
		self.jid = jid

		super(WAMediaHandler,self).__init__();
Esempio n. 18
0
	def __init__(self,domain,resource,user,push_name,password):
		
		WADebug.attach(self);
		
		self.domain = domain;
		self.resource = resource;
		self.user=user;
		self.push_name=push_name;
		self.password = password;
		self.jid = user+'@'+domain
		self.fromm = user+'@'+domain+'/'+resource;
		self.retry = True
		self.eventHandler = WAEventHandler(self);	
		
		
		self.disconnectRequested = False
		
		self.connTries = 0;
		
		self.verbose = True
		self.iqId = 0;
	
		
		self.waiting = 0;
Esempio n. 19
0
 def __init__(self):
     WADebug.attach(self)
     super(WARequest, self).__init__()
Esempio n. 20
0
    def __init__(self):
        WADebug.attach(self)

        super(SMSHandler, self).__init__()
Esempio n. 21
0
    def __init__(self):
        WADebug.attach(self)

        super(SMSHandler, self).__init__()
Esempio n. 22
0
	def __init__(self):
		WADebug.attach(self);
		super(WARequest,self).__init__();
Esempio n. 23
0
	def __init__(self):
		WADebug.attach(self);
		self.squircleLoaded = False;