Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evert Mouw
gajim-plugins
Commits
b224467c
Commit
b224467c
authored
13 years ago
by
Kjell Braden
Browse files
Options
Downloads
Patches
Plain Diff
merge gotr plugin with upstream repo
parent
73b28ae6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gotr/manifest.ini
+1
-1
1 addition, 1 deletion
gotr/manifest.ini
gotr/otrmodule.py
+15
-13
15 additions, 13 deletions
gotr/otrmodule.py
gotr/ui.py
+5
-3
5 additions, 3 deletions
gotr/ui.py
with
21 additions
and
17 deletions
gotr/manifest.ini
+
1
−
1
View file @
b224467c
[info]
name:
Off-The-Record
Encryption
short_name:
gotr
version:
1.
2
version:
1.
4
description:
See
http://www.cypherpunks.ca/otr/
authors:
Kjell
Braden
<afflux.gajim@pentabarf.de>
homepage:
http://gajim-otr.pentabarf.de
This diff is collapsed.
Click to expand it.
gotr/otrmodule.py
+
15
−
13
View file @
b224467c
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
## otrmodule.py
##
## Copyright
(C)
2008-201
0
Kjell Braden <
fnord
@pentabarf.de>
## Copyright 2008-201
2
Kjell Braden <
afflux
@pentabarf.de>
##
## This file is part of Gajim.
##
...
...
@@ -29,7 +29,7 @@ Off-The-Record encryption plugin.
:license: GPL
'''
MINVERSION
=
(
1
,
0
,
0
,
'
beta
3
'
)
MINVERSION
=
(
1
,
0
,
0
,
'
beta
4
'
)
IGNORE
=
True
PASS
=
False
...
...
@@ -72,6 +72,8 @@ import pickle
HAS_POTR
=
True
try
:
import
potr
if
not
hasattr
(
potr
,
'
VERSION
'
)
or
potr
.
VERSION
<
MINVERSION
:
raise
ImportError
(
'
old / unsupported python-otr version
'
)
except
ImportError
:
HAS_POTR
=
False
...
...
@@ -152,7 +154,7 @@ class GajimOtrAccount(potr.context.Account):
def
dropPrivkey
(
self
):
try
:
os
.
remove
(
self
.
keyFilePath
+
'
.key
2
'
)
os
.
remove
(
self
.
keyFilePath
+
'
.key
3
'
)
except
IOError
,
e
:
if
e
.
errno
!=
2
:
log
.
exception
(
'
IOError occurred when removing key file for %s
'
,
...
...
@@ -161,8 +163,8 @@ class GajimOtrAccount(potr.context.Account):
def
loadPrivkey
(
self
):
try
:
with
open
(
self
.
keyFilePath
+
'
.key
2
'
,
'
r
'
)
as
keyFile
:
return
p
ickle
.
load
(
keyFile
)
with
open
(
self
.
keyFilePath
+
'
.key
3
'
,
'
r
b
'
)
as
keyFile
:
return
p
otr
.
crypt
.
PK
.
parsePrivateKey
(
keyFile
.
read
())[
0
]
except
IOError
,
e
:
if
e
.
errno
!=
2
:
log
.
exception
(
'
IOError occurred when loading key file for %s
'
,
...
...
@@ -171,8 +173,8 @@ class GajimOtrAccount(potr.context.Account):
def
savePrivkey
(
self
):
try
:
with
open
(
self
.
keyFilePath
+
'
.key
2
'
,
'
w
'
)
as
keyFile
:
pickle
.
dump
(
self
.
getPrivkey
()
,
keyFile
)
with
open
(
self
.
keyFilePath
+
'
.key
3
'
,
'
w
b
'
)
as
keyFile
:
keyFile
.
write
(
self
.
getPrivkey
()
.
serializePrivateKey
()
)
except
IOError
,
e
:
log
.
exception
(
'
IOError occurred when loading key file for %s
'
,
self
.
name
)
...
...
@@ -489,6 +491,12 @@ class OtrPlugin(GajimPlugin):
'
jid
'
:
event
.
fjid
,
'
error
'
:
e
},
account
,
event
.
fjid
)
return
IGNORE
if
ctx
is
not
None
:
ctx
.
smpWindow
.
handle_tlv
(
tlvs
)
if
not
msgtxt
:
return
IGNORE
event
.
msgtxt
=
unicode
(
msgtxt
)
event
.
stanza
.
setBody
(
event
.
msgtxt
)
...
...
@@ -496,12 +504,6 @@ class OtrPlugin(GajimPlugin):
if
html_node
:
event
.
stanza
.
delChild
(
html_node
)
if
ctx
is
not
None
:
ctx
.
smpWindow
.
handle_tlv
(
tlvs
)
if
not
msgtxt
:
return
IGNORE
return
PASS
def
handle_outgoing_msg
(
self
,
event
):
...
...
This diff is collapsed.
Click to expand it.
gotr/ui.py
+
5
−
3
View file @
b224467c
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
## ui.py
##
## Copyright
(C)
2008-201
0
Kjell Braden <
fnord
@pentabarf.de>
## Copyright 2008-201
2
Kjell Braden <
afflux
@pentabarf.de>
##
## This file is part of Gajim.
##
...
...
@@ -214,6 +214,7 @@ class ContactOtrSmpWindow:
def
__init__
(
self
,
ctx
):
self
.
question
=
None
self
.
smp_running
=
False
self
.
ctx
=
ctx
self
.
account
=
ctx
.
user
.
accountname
...
...
@@ -331,18 +332,19 @@ class ContactOtrSmpWindow:
if
tlvs
:
is1qtlv
=
self
.
get_tlv
(
tlvs
,
potr
.
proto
.
SMP1QTLV
)
# check for TLV_SMP_ABORT or state = CHEATED
if
not
self
.
ctx
.
smpIsValid
():
self
.
_abort
()
if
self
.
smp_running
and
not
self
.
ctx
.
smpIsValid
():
self
.
_finish
(
_
(
'
SMP verifying aborted
'
))
# check for TLV_SMP1
elif
self
.
get_tlv
(
tlvs
,
potr
.
proto
.
SMP1TLV
):
self
.
smp_running
=
True
self
.
question
=
None
self
.
show
(
True
)
self
.
gw
(
'
progressbar
'
).
set_fraction
(
0.3
)
# check for TLV_SMP1Q
elif
is1qtlv
:
self
.
smp_running
=
True
self
.
question
=
is1qtlv
.
msg
self
.
show
(
True
)
self
.
gw
(
'
progressbar
'
).
set_fraction
(
0.3
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment