* Add comment explaining logic of displaying join_gc window
* correct grammar regression
This commit is contained in:
parent
d05728fc55
commit
3da22df9c1
|
@ -18,8 +18,10 @@
|
|||
##
|
||||
|
||||
from os import tmpfile
|
||||
from dialogs import *
|
||||
|
||||
USE_GPG = True
|
||||
GPG_DEBUG = True
|
||||
|
||||
try:
|
||||
import GnuPGInterface # Debian package doesn't distribute 'our' file
|
||||
|
@ -54,19 +56,23 @@ else:
|
|||
resp = {}
|
||||
while 1:
|
||||
line = child_stdout.readline()
|
||||
if line == "": break
|
||||
if line == '': break
|
||||
line = line.rstrip()
|
||||
if line[0:9] == '[GNUPG:] ':
|
||||
# Chop off the prefix
|
||||
line = line[9:]
|
||||
L = line.split(None, 1)
|
||||
keyword = L[0]
|
||||
if len(L) > 1:
|
||||
resp[ keyword ] = L[1]
|
||||
else:
|
||||
resp[ keyword ] = ""
|
||||
# self._handle_response(L.pop(0), L)
|
||||
return resp
|
||||
|
||||
def _handle_response(self, response, parameters):
|
||||
return
|
||||
#if response == 'NEED_PASSPHRASE':
|
||||
#w = dialogs.PassphraseDialog(
|
||||
# _('Password Required'),
|
||||
# _('Enter your password for key %s') % parameters[0][:8],
|
||||
# _('Save password'))
|
||||
#self.passphrase[parameters[0][:8]], save = w.run()
|
||||
|
||||
def encrypt(self, str, recipients):
|
||||
if not USE_GPG:
|
||||
return str
|
||||
|
@ -98,25 +104,34 @@ else:
|
|||
except IOError: pass
|
||||
return output
|
||||
|
||||
def sign(self, str, keyID):
|
||||
def sign(self, data, keyID):
|
||||
if not USE_GPG:
|
||||
return str
|
||||
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr'])
|
||||
proc.handles['stdin'].write(str)
|
||||
return data
|
||||
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr', 'passphrase'])
|
||||
proc.handles['stdin'].write(data)
|
||||
proc.handles['stdin'].close()
|
||||
proc.handles['passphrase'].close()
|
||||
stat = proc.handles['status']
|
||||
while 1:
|
||||
line = stat.readline()
|
||||
print line
|
||||
if line == '': break
|
||||
line = line.rstrip()
|
||||
if line[0:9] == '[GNUPG:] ':
|
||||
line = line[9:]
|
||||
L = line.split(None, 1)
|
||||
print L
|
||||
#self._handle_response(L.pop(0), L)
|
||||
proc.handles['status'].close()
|
||||
|
||||
output = proc.handles['stdout'].read()
|
||||
proc.handles['stdout'].close()
|
||||
proc.handles['stderr'].close()
|
||||
|
||||
stat = proc.handles['status']
|
||||
resp = self._read_response(stat)
|
||||
proc.handles['status'].close()
|
||||
|
||||
try: proc.wait()
|
||||
except IOError: pass
|
||||
if resp.has_key('GOOD_PASSPHRASE') or resp.has_key('SIG_CREATED'):
|
||||
return self._stripHeaderFooter(output)
|
||||
#if resp.has_key('GOOD_PASSPHRASE') or resp.has_key('SIG_CREATED'):
|
||||
# return self._stripHeaderFooter(output)
|
||||
return 'BAD_PASSPHRASE'
|
||||
|
||||
def verify(self, str, sign):
|
||||
|
|
|
@ -700,8 +700,7 @@ class GroupchatWindow(chat.Chat):
|
|||
else:
|
||||
server = servernick
|
||||
nick = ''
|
||||
#FIXME: autojoin with current nick or with the nick specified
|
||||
#do not open join_gc window
|
||||
#join_gc window is needed in order to provide for password entry.
|
||||
if self.plugin.windows[self.account].has_key('join_gc'):
|
||||
self.plugin.windows[self.account]['join_gc'].window.present()
|
||||
else:
|
||||
|
@ -810,7 +809,7 @@ occupant specified by nickname from the room and optionally displays a \
|
|||
reason. Does NOT support spaces in nickname.') % command, room_jid)
|
||||
elif command == 'me':
|
||||
self.print_conversation(_('Usage: /%s <action>, sends action to the \
|
||||
current room. Use third person. (e.g. /%s explodes)') %
|
||||
current room. Use third person. (e.g. /%s explodes.)') %
|
||||
(command, command), room_jid)
|
||||
elif command == 'msg':
|
||||
s = _('Usage: /%s <nickname> [message], opens a private message window and sends message to the occupant specified by nickname.') % command
|
||||
|
|
Loading…
Reference in New Issue