Exemplo n.º 1
0
    def onUploadSuccess(self, filePath, jid, url):
        #convenience method to detect file/image attributes for sending, requires existence of 'pillow' library
        print("Upload success")
        entity = OutgoingChatstateProtocolEntity(ChatstateProtocolEntity.STATE_TYPING, jid)
        self.toLower(entity)
	entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, jid)
        self.toLower(entity)
Exemplo n.º 2
0
    def imageSend(self, filePath, url, to, ip=None, caption=None):
        
        # create the entity object to be passed down
        entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, ip, to, caption=caption)
        logger.debug('Sending image %s to %s' %(url, to))

        self.toLower(entity)
Exemplo n.º 3
0
    def imageSend(self, filePath, url, to, ip=None, caption=None):

        # create the entity object to be passed down
        entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
            filePath, url, ip, to, caption=caption)
        logger.debug('Sending image %s to %s' % (url, to))

        self.toLower(entity)
Exemplo n.º 4
0
 def onUploadSuccess(self, filePath, jid, url):
     #convenience method to detect file/image attributes for sending, requires existence of 'pillow' library
     logging.info("Upload success")
     entity = OutgoingChatstateProtocolEntity(
         ChatstateProtocolEntity.STATE_TYPING, jid)
     self.toLower(entity)
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
         filePath, url, None, jid)
     self.toLower(entity)
Exemplo n.º 5
0
    def send_file(self, file_path, url, to, ip=None):
        filename, extension = os.path.splitext(file_path)
        entity = None

        if extension in EXT_IMAGE:
            entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to)
        elif extension in EXT_VIDEO:
            entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "video", ip, to)
        elif extension in EXT_AUDIO:
            entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "audio", ip, to)
        if entity:
            self.toLower(entity)
Exemplo n.º 6
0
    def send_file(self, file_path, url, to, ip=None):
        filename, extension = os.path.splitext(file_path)
        entity = None

        if extension in EXT_IMAGE:
            entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, ip, to)
        elif extension in EXT_VIDEO:
            entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "video", ip, to)
        elif extension in EXT_AUDIO:
            entity = DownloadableMediaMessageProtocolEntity.fromFilePath(file_path, url, "audio", ip, to)
        if entity:
            self.toLower(entity)
Exemplo n.º 7
0
 def sendMediaForReal(x):
     result, url = x
     print("Sending for real now")
     ip = result.getIp()
     if mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE:
         entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
             path, url, ip, jid, caption=caption)
     elif mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_AUDIO:
         entity = AudioDownloadableMediaMessageProtocolEntity.fromFilePath(
             path, url, ip, jid)
     elif mediaType == RequestUploadIqProtocolEntity.MEDIA_TYPE_VIDEO:
         entity = VideoDownloadableMediaMessageProtocolEntity.fromFilePath(
             path, url, ip, jid, caption=caption)
     if not entity:
         raise ValueError()
     self.toLower(entity)
 def send_uploaded_media(self, fpath, jid, url, ip = None):
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
             fpath, url, ip, jid)
     if not args.dry:
         self.stack.execDetached(self.stack.send(entity))
 def send_uploaded_media(self, fpath, jid, url, ip=None):
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
         fpath, url, ip, jid)
     if not args.dry:
         self.stack.execDetached(self.stack.send(entity))
Exemplo n.º 10
0
 def doSendImage(self, filePath, url, to, ip = "127.0.0.1", caption = None):
     logger.info('filepath:%s url:%s to:%s ip:%s caption:%s ' % (filePath, url, to, ip, caption))
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, ip, to, caption = caption)
     self.toLower(entity)
Exemplo n.º 11
0
 def doSendImage(self, filePath, url, to, ip=None):
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
         filePath, url, ip, to)
     self.toLower(entity)
Exemplo n.º 12
0
 def onUploadError(self, filePath, jid, url):
     print("Upload file failed!")
     print(ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, jid))
Exemplo n.º 13
0
 def doSendImage(self,filePath,url,to,ip=None):
   entity=ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath,url,ip,to)
   self.toLower(entity)
Exemplo n.º 14
0
 def onUploadError(self, filePath, jid, url):
     logging.info("Upload file failed!")
     logging.info(
         ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
             filePath, url, None, jid))
Exemplo n.º 15
0
 def doSendImage(self, filePath, url, to, ip="127.0.0.1", caption=None):
     logger.info('filepath:%s url:%s to:%s ip:%s caption:%s ' %
                 (filePath, url, to, ip, caption))
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
         filePath, url, ip, to, caption=caption)
     self.toLower(entity)
Exemplo n.º 16
0
 def send_uploaded_media(self, fpath, jid, url, ip=None):
     entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(
         fpath, url, ip, jid)
     if not args.dry:
         self._yowsup.toLower(entity)
Exemplo n.º 17
0
	def onUploadSuccess(self, filePath, receiver_jid, url):
		#convenience method to detect file/image attributes for sending, requires existence of 'pillow' library
		entity = ImageDownloadableMediaMessageProtocolEntity.fromFilePath(filePath, url, None, receiver_jid)
		self.toLower(entity)