def _processSendRequestSlot(self, peerID, peerIP, value, transferDict):
     if transferDict is None:
         try:
             transferDict = json.loads(value)
             
             if not type(transferDict) is dict:
                 self.logger.warning("transferDict is no dict.")
                 return
         except:
             self.logger.exception("Could not parse transfer dict.")
             return
     
     if not u"id" in transferDict:
         self.logger.warning("No transfer ID in transfer dict. Cannot accept request")
         return
     
     if not u"name" in transferDict:
         self.logger.warning("No file name in transfer dict. Cannot accept request")
         return
     
     if not u"size" in transferDict:
         self.logger.warning("No file size in transfer dict. Cannot accept request")
         return
     
     transferID = transferDict[u"id"]
     size = transferDict[u"size"]
     name = transferDict.get(u"name", None)
     numFiles = transferDict.get(u"count", 1)
     
     if ((peerID, transferID) in self._incoming):
         self.logger.debug(u"Ignoring duplicate file transfer from peer %s (%d)", peerID, transferID)
         return
     
     if not os.path.exists(self._downloadDir):
         os.makedirs(self._downloadDir)
     elif not os.path.isdir(self._downloadDir):
         self.logger.error("Download path %s is no directory. Cannot accept file.")
         return
     
     if numFiles > 1:
         peerName = get_peers().getDisplayedPeerName(pID=peerID)
         if peerName:
             dirName = u"%s (%s)" % (sanitizeForFilename(peerName), peerID)
         else:
             dirName = peerID
         targetDir = os.path.join(self._downloadDir, dirName)
         if not os.path.exists(targetDir) or not os.path.isdir(targetDir):
             targetDir = getUniquePath(targetDir)
             os.makedirs(targetDir)
     else:
         targetDir = self._downloadDir
     
     port = DataReceiverThread.getOpenPort(blockPort=True)
     inThread = DataReceiverThread.receive(peerIP, targetDir, port, transferDict, self.logger, overwrite=self._overwrite, parent=self)
     inThread.setUserData((peerID, transferID))
     inThread.errorOnTransfer.connect(self._errorDownloading)
     inThread.successfullyTransferred.connect(self._removeDownload)
     inThread.transferCanceled.connect(self._transferCanceled)
     inThread.finished.connect(inThread.deleteLater)
     self._incoming[(peerID, transferID)] = inThread
     inThread.start()
     
     self.incomingTransferStarted.emit(peerID, transferID, targetDir, numFiles, size, name, inThread)
     
     answerDict = {u"id" : transferID,
                   u"port" : port}
     get_server().call("HELO_FT_ACK %s" % json.dumps(answerDict), peerIPs=[peerIP])
 def _createPictureFile(self, category, ext='.jpg'):
     prefix = sanitizeForFilename(category)
     return tempfile.NamedTemporaryFile(suffix=ext, prefix=prefix, dir=self._getPicturesDirectory(), delete=False)