Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
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
eta
gajim
Commits
cc19d023
Commit
cc19d023
authored
17 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
fix var name (conflict with module name)
parent
973f4bcc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/profile_window.py
+24
-24
24 additions, 24 deletions
src/profile_window.py
with
24 additions
and
24 deletions
src/profile_window.py
+
24
−
24
View file @
cc19d023
...
...
@@ -192,19 +192,19 @@ class ProfileWindow:
except
AttributeError
:
pass
def
set_values
(
self
,
vcard
):
def
set_values
(
self
,
vcard
_
):
button
=
self
.
xml
.
get_widget
(
'
PHOTO_button
'
)
image
=
button
.
get_image
()
text_button
=
self
.
xml
.
get_widget
(
'
NOPHOTO_button
'
)
if
not
'
PHOTO
'
in
vcard
:
if
not
'
PHOTO
'
in
vcard
_
:
# set default image
image
.
set_from_pixbuf
(
None
)
button
.
hide
()
text_button
.
show
()
for
i
in
vcard
.
keys
():
for
i
in
vcard
_
.
keys
():
if
i
==
'
PHOTO
'
:
pixbuf
,
self
.
avatar_encoded
,
self
.
avatar_mime_type
=
\
vcard
.
get_avatar_pixbuf_encoded_mime
(
vcard
[
i
])
vcard
.
get_avatar_pixbuf_encoded_mime
(
vcard
_
[
i
])
if
not
pixbuf
:
image
.
set_from_pixbuf
(
None
)
button
.
hide
()
...
...
@@ -216,21 +216,21 @@ class ProfileWindow:
text_button
.
hide
()
continue
if
i
==
'
ADR
'
or
i
==
'
TEL
'
or
i
==
'
EMAIL
'
:
for
entry
in
vcard
[
i
]:
for
entry
in
vcard
_
[
i
]:
add_on
=
'
_HOME
'
if
'
WORK
'
in
entry
:
add_on
=
'
_WORK
'
for
j
in
entry
.
keys
():
self
.
set_value
(
i
+
add_on
+
'
_
'
+
j
+
'
_entry
'
,
entry
[
j
])
if
isinstance
(
vcard
[
i
],
dict
):
for
j
in
vcard
[
i
].
keys
():
self
.
set_value
(
i
+
'
_
'
+
j
+
'
_entry
'
,
vcard
[
i
][
j
])
if
isinstance
(
vcard
_
[
i
],
dict
):
for
j
in
vcard
_
[
i
].
keys
():
self
.
set_value
(
i
+
'
_
'
+
j
+
'
_entry
'
,
vcard
_
[
i
][
j
])
else
:
if
i
==
'
DESC
'
:
self
.
xml
.
get_widget
(
'
DESC_textview
'
).
get_buffer
().
set_text
(
vcard
[
i
],
0
)
vcard
_
[
i
],
0
)
else
:
self
.
set_value
(
i
+
'
_entry
'
,
vcard
[
i
])
self
.
set_value
(
i
+
'
_entry
'
,
vcard
_
[
i
])
if
self
.
update_progressbar_timeout_id
is
not
None
:
if
self
.
message_id
:
self
.
statusbar
.
remove
(
self
.
context_id
,
self
.
message_id
)
...
...
@@ -243,10 +243,10 @@ class ProfileWindow:
self
.
progressbar
.
set_fraction
(
0
)
self
.
update_progressbar_timeout_id
=
None
def
add_to_vcard
(
self
,
vcard
,
entry
,
txt
):
def
add_to_vcard
(
self
,
vcard
_
,
entry
,
txt
):
'''
Add an information to the vCard dictionary
'''
entries
=
entry
.
split
(
'
_
'
)
loc
=
vcard
loc
=
vcard
_
if
len
(
entries
)
==
3
:
# We need to use lists
if
not
loc
.
has_key
(
entries
[
0
]):
loc
[
entries
[
0
]]
=
[]
...
...
@@ -259,14 +259,14 @@ class ProfileWindow:
e
[
entries
[
2
]]
=
txt
else
:
loc
[
entries
[
0
]].
append
({
entries
[
1
]:
''
,
entries
[
2
]:
txt
})
return
vcard
return
vcard
_
while
len
(
entries
)
>
1
:
if
not
loc
.
has_key
(
entries
[
0
]):
loc
[
entries
[
0
]]
=
{}
loc
=
loc
[
entries
[
0
]]
del
entries
[
0
]
loc
[
entries
[
0
]]
=
txt
return
vcard
return
vcard
_
def
make_vcard
(
self
):
'''
make the vCard dictionary
'''
...
...
@@ -277,11 +277,11 @@ class ProfileWindow:
'
ORG_ORGUNIT
'
,
'
TITLE
'
,
'
ROLE
'
,
'
TEL_WORK_NUMBER
'
,
'
EMAIL_WORK_USERID
'
,
'
ADR_WORK_STREET
'
,
'
ADR_WORK_EXTADR
'
,
'
ADR_WORK_LOCALITY
'
,
'
ADR_WORK_REGION
'
,
'
ADR_WORK_PCODE
'
,
'
ADR_WORK_CTRY
'
]
vcard
=
{}
vcard
_
=
{}
for
e
in
entries
:
txt
=
self
.
xml
.
get_widget
(
e
+
'
_entry
'
).
get_text
().
decode
(
'
utf-8
'
)
if
txt
!=
''
:
vcard
=
self
.
add_to_vcard
(
vcard
,
e
,
txt
)
vcard
_
=
self
.
add_to_vcard
(
vcard
_
,
e
,
txt
)
# DESC textview
buff
=
self
.
xml
.
get_widget
(
'
DESC_textview
'
).
get_buffer
()
...
...
@@ -289,14 +289,14 @@ class ProfileWindow:
end_iter
=
buff
.
get_end_iter
()
txt
=
buff
.
get_text
(
start_iter
,
end_iter
,
0
)
if
txt
!=
''
:
vcard
[
'
DESC
'
]
=
txt
.
decode
(
'
utf-8
'
)
vcard
_
[
'
DESC
'
]
=
txt
.
decode
(
'
utf-8
'
)
# Avatar
if
self
.
avatar_encoded
:
vcard
[
'
PHOTO
'
]
=
{
'
BINVAL
'
:
self
.
avatar_encoded
}
vcard
_
[
'
PHOTO
'
]
=
{
'
BINVAL
'
:
self
.
avatar_encoded
}
if
self
.
avatar_mime_type
:
vcard
[
'
PHOTO
'
][
'
TYPE
'
]
=
self
.
avatar_mime_type
return
vcard
vcard
_
[
'
PHOTO
'
][
'
TYPE
'
]
=
self
.
avatar_mime_type
return
vcard
_
def
on_ok_button_clicked
(
self
,
widget
):
if
self
.
update_progressbar_timeout_id
:
...
...
@@ -307,14 +307,14 @@ class ProfileWindow:
_
(
'
Without a connection you can not publish your contact
'
'
information.
'
))
return
vcard
=
self
.
make_vcard
()
vcard
_
=
self
.
make_vcard
()
nick
=
''
if
vcard
.
has_key
(
'
NICKNAME
'
):
nick
=
vcard
[
'
NICKNAME
'
]
if
vcard
_
.
has_key
(
'
NICKNAME
'
):
nick
=
vcard
_
[
'
NICKNAME
'
]
if
nick
==
''
:
nick
=
gajim
.
config
.
get_per
(
'
accounts
'
,
self
.
account
,
'
name
'
)
gajim
.
nicks
[
self
.
account
]
=
nick
gajim
.
connections
[
self
.
account
].
send_vcard
(
vcard
)
gajim
.
connections
[
self
.
account
].
send_vcard
(
vcard
_
)
self
.
message_id
=
self
.
statusbar
.
push
(
self
.
context_id
,
_
(
'
Sending profile...
'
))
self
.
progressbar
.
show
()
...
...
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