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
Weblate
gajim
Commits
55476440
Commit
55476440
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
coding standards
parent
816dc776
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/groupchat_control.py
+49
-43
49 additions, 43 deletions
src/groupchat_control.py
with
49 additions
and
43 deletions
src/groupchat_control.py
+
49
−
43
View file @
55476440
...
@@ -56,7 +56,7 @@ C_TEXT, # text shown in the cellrenderer
...
@@ -56,7 +56,7 @@ C_TEXT, # text shown in the cellrenderer
C_AVATAR
,
# avatar of the contact
C_AVATAR
,
# avatar of the contact
)
=
range
(
5
)
)
=
range
(
5
)
def
set_renderer_color
(
treeview
,
renderer
,
set_background
=
True
):
def
set_renderer_color
(
treeview
,
renderer
,
set_background
=
True
):
'''
set style for group row, using PRELIGHT system color
'''
'''
set style for group row, using PRELIGHT system color
'''
if
set_background
:
if
set_background
:
bgcolor
=
treeview
.
style
.
bg
[
gtk
.
STATE_PRELIGHT
]
bgcolor
=
treeview
.
style
.
bg
[
gtk
.
STATE_PRELIGHT
]
...
@@ -355,7 +355,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -355,7 +355,7 @@ class GroupchatControl(ChatControlBase):
def
add_avatar_renderer
():
def
add_avatar_renderer
():
renderer_pixbuf
=
gtk
.
CellRendererPixbuf
()
# avatar image
renderer_pixbuf
=
gtk
.
CellRendererPixbuf
()
# avatar image
column
.
pack_start
(
renderer_pixbuf
,
expand
=
False
)
column
.
pack_start
(
renderer_pixbuf
,
expand
=
False
)
column
.
add_attribute
(
renderer_pixbuf
,
'
pixbuf
'
,
C_AVATAR
)
column
.
add_attribute
(
renderer_pixbuf
,
'
pixbuf
'
,
C_AVATAR
)
column
.
set_cell_data_func
(
renderer_pixbuf
,
tree_cell_data_func
,
column
.
set_cell_data_func
(
renderer_pixbuf
,
tree_cell_data_func
,
self
.
list_treeview
)
self
.
list_treeview
)
...
@@ -365,13 +365,13 @@ class GroupchatControl(ChatControlBase):
...
@@ -365,13 +365,13 @@ class GroupchatControl(ChatControlBase):
renderer_image
=
cell_renderer_image
.
CellRendererImage
(
0
,
0
)
# status img
renderer_image
=
cell_renderer_image
.
CellRendererImage
(
0
,
0
)
# status img
renderer_image
.
set_property
(
'
width
'
,
26
)
renderer_image
.
set_property
(
'
width
'
,
26
)
column
.
pack_start
(
renderer_image
,
expand
=
False
)
column
.
pack_start
(
renderer_image
,
expand
=
False
)
column
.
add_attribute
(
renderer_image
,
'
image
'
,
C_IMG
)
column
.
add_attribute
(
renderer_image
,
'
image
'
,
C_IMG
)
column
.
set_cell_data_func
(
renderer_image
,
tree_cell_data_func
,
column
.
set_cell_data_func
(
renderer_image
,
tree_cell_data_func
,
self
.
list_treeview
)
self
.
list_treeview
)
renderer_text
=
gtk
.
CellRendererText
()
# nickname
renderer_text
=
gtk
.
CellRendererText
()
# nickname
column
.
pack_start
(
renderer_text
,
expand
=
True
)
column
.
pack_start
(
renderer_text
,
expand
=
True
)
column
.
add_attribute
(
renderer_text
,
'
markup
'
,
C_TEXT
)
column
.
add_attribute
(
renderer_text
,
'
markup
'
,
C_TEXT
)
renderer_text
.
set_property
(
"
ellipsize
"
,
pango
.
ELLIPSIZE_END
)
renderer_text
.
set_property
(
"
ellipsize
"
,
pango
.
ELLIPSIZE_END
)
column
.
set_cell_data_func
(
renderer_text
,
tree_cell_data_func
,
column
.
set_cell_data_func
(
renderer_text
,
tree_cell_data_func
,
...
@@ -385,7 +385,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -385,7 +385,7 @@ class GroupchatControl(ChatControlBase):
# workaround to avoid gtk arrows to be shown
# workaround to avoid gtk arrows to be shown
column
=
gtk
.
TreeViewColumn
()
# 2nd COLUMN
column
=
gtk
.
TreeViewColumn
()
# 2nd COLUMN
renderer
=
gtk
.
CellRendererPixbuf
()
renderer
=
gtk
.
CellRendererPixbuf
()
column
.
pack_start
(
renderer
,
expand
=
False
)
column
.
pack_start
(
renderer
,
expand
=
False
)
self
.
list_treeview
.
append_column
(
column
)
self
.
list_treeview
.
append_column
(
column
)
column
.
set_visible
(
False
)
column
.
set_visible
(
False
)
self
.
list_treeview
.
set_expander_column
(
column
)
self
.
list_treeview
.
set_expander_column
(
column
)
...
@@ -457,7 +457,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -457,7 +457,7 @@ class GroupchatControl(ChatControlBase):
for
nick
in
sorted
(
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
for
nick
in
sorted
(
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
self
.
room_jid
)):
self
.
room_jid
)):
item
=
gtk
.
MenuItem
(
nick
,
use_underline
=
False
)
item
=
gtk
.
MenuItem
(
nick
,
use_underline
=
False
)
submenu
.
append
(
item
)
submenu
.
append
(
item
)
id_
=
item
.
connect
(
'
activate
'
,
self
.
append_nick_in_msg_textview
,
nick
)
id_
=
item
.
connect
(
'
activate
'
,
self
.
append_nick_in_msg_textview
,
nick
)
self
.
handlers
[
id_
]
=
item
self
.
handlers
[
id_
]
=
item
...
@@ -622,7 +622,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -622,7 +622,7 @@ class GroupchatControl(ChatControlBase):
self
.
name_label
.
set_markup
(
text
)
self
.
name_label
.
set_markup
(
text
)
if
self
.
subject
:
if
self
.
subject
:
subject
=
helpers
.
reduce_chars_newlines
(
self
.
subject
,
max_lines
=
2
)
subject
=
helpers
.
reduce_chars_newlines
(
self
.
subject
,
max_lines
=
2
)
subject
=
gobject
.
markup_escape_text
(
subject
)
subject
=
gobject
.
markup_escape_text
(
subject
)
if
gajim
.
HAVE_PYSEXY
:
if
gajim
.
HAVE_PYSEXY
:
subject_text
=
self
.
urlfinder
.
sub
(
self
.
make_href
,
subject
)
subject_text
=
self
.
urlfinder
.
sub
(
self
.
make_href
,
subject
)
...
@@ -643,7 +643,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -643,7 +643,7 @@ class GroupchatControl(ChatControlBase):
self
.
banner_status_label
.
set_markup
(
subject_text
)
self
.
banner_status_label
.
set_markup
(
subject_text
)
def
prepare_context_menu
(
self
,
hide_buttonbar_entries
=
False
):
def
prepare_context_menu
(
self
,
hide_buttonbar_entries
=
False
):
'''
sets sensitivity state for configure_room
'''
'''
sets sensitivity state for configure_room
'''
ag
=
gtk
.
accel_groups_from_object
(
self
.
parent_win
.
window
)[
0
]
ag
=
gtk
.
accel_groups_from_object
(
self
.
parent_win
.
window
)[
0
]
self
.
change_nick_menuitem
.
add_accelerator
(
'
activate
'
,
ag
,
gtk
.
keysyms
.
n
,
self
.
change_nick_menuitem
.
add_accelerator
(
'
activate
'
,
ag
,
gtk
.
keysyms
.
n
,
...
@@ -720,7 +720,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -720,7 +720,7 @@ class GroupchatControl(ChatControlBase):
self
.
print_conversation
(
msg
,
nick
,
tim
,
xhtml
)
self
.
print_conversation
(
msg
,
nick
,
tim
,
xhtml
)
def
on_private_message
(
self
,
nick
,
msg
,
tim
,
xhtml
,
session
,
def
on_private_message
(
self
,
nick
,
msg
,
tim
,
xhtml
,
session
,
msg_id
=
None
,
encrypted
=
False
):
msg_id
=
None
,
encrypted
=
False
):
# Do we have a queue?
# Do we have a queue?
fjid
=
self
.
room_jid
+
'
/
'
+
nick
fjid
=
self
.
room_jid
+
'
/
'
+
nick
no_queue
=
len
(
gajim
.
events
.
get_events
(
self
.
account
,
fjid
))
==
0
no_queue
=
len
(
gajim
.
events
.
get_events
(
self
.
account
,
fjid
))
==
0
...
@@ -739,7 +739,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -739,7 +739,7 @@ class GroupchatControl(ChatControlBase):
model
=
self
.
list_treeview
.
get_model
()
model
=
self
.
list_treeview
.
get_model
()
state_images
=
\
state_images
=
\
gajim
.
interface
.
roster
.
get_appropriate_state_images
(
gajim
.
interface
.
roster
.
get_appropriate_state_images
(
self
.
room_jid
,
icon_name
=
'
event
'
)
self
.
room_jid
,
icon_name
=
'
event
'
)
image
=
state_images
[
'
event
'
]
image
=
state_images
[
'
event
'
]
model
[
iter_
][
C_IMG
]
=
image
model
[
iter_
][
C_IMG
]
=
image
if
self
.
parent_win
:
if
self
.
parent_win
:
...
@@ -778,7 +778,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -778,7 +778,7 @@ class GroupchatControl(ChatControlBase):
fin
=
True
fin
=
True
return
None
return
None
def
print_old_conversation
(
self
,
text
,
contact
=
''
,
tim
=
None
,
def
print_old_conversation
(
self
,
text
,
contact
=
''
,
tim
=
None
,
xhtml
=
None
):
xhtml
=
None
):
if
isinstance
(
text
,
str
):
if
isinstance
(
text
,
str
):
text
=
unicode
(
text
,
'
utf-8
'
)
text
=
unicode
(
text
,
'
utf-8
'
)
...
@@ -795,9 +795,9 @@ class GroupchatControl(ChatControlBase):
...
@@ -795,9 +795,9 @@ class GroupchatControl(ChatControlBase):
small_attr
=
[]
small_attr
=
[]
ChatControlBase
.
print_conversation_line
(
self
,
text
,
kind
,
contact
,
tim
,
ChatControlBase
.
print_conversation_line
(
self
,
text
,
kind
,
contact
,
tim
,
small_attr
,
small_attr
+
[
'
restored_message
'
],
small_attr
,
small_attr
+
[
'
restored_message
'
],
small_attr
+
[
'
restored_message
'
],
count_as_new
=
False
,
xhtml
=
xhtml
)
small_attr
+
[
'
restored_message
'
],
count_as_new
=
False
,
xhtml
=
xhtml
)
def
print_conversation
(
self
,
text
,
contact
=
''
,
tim
=
None
,
xhtml
=
None
):
def
print_conversation
(
self
,
text
,
contact
=
''
,
tim
=
None
,
xhtml
=
None
):
'''
Print a line in the conversation:
'''
Print a line in the conversation:
if contact is set: it
'
s a message from someone or an info message (contact
if contact is set: it
'
s a message from someone or an info message (contact
=
'
info
'
in such a case)
=
'
info
'
in such a case)
...
@@ -860,7 +860,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -860,7 +860,7 @@ class GroupchatControl(ChatControlBase):
self
.
check_and_possibly_add_focus_out_line
()
self
.
check_and_possibly_add_focus_out_line
()
ChatControlBase
.
print_conversation_line
(
self
,
text
,
kind
,
contact
,
tim
,
ChatControlBase
.
print_conversation_line
(
self
,
text
,
kind
,
contact
,
tim
,
other_tags_for_name
,
[],
other_tags_for_text
,
xhtml
=
xhtml
)
other_tags_for_name
,
[],
other_tags_for_text
,
xhtml
=
xhtml
)
def
get_nb_unread
(
self
):
def
get_nb_unread
(
self
):
type_events
=
[
'
printed_marked_gc_msg
'
]
type_events
=
[
'
printed_marked_gc_msg
'
]
...
@@ -883,7 +883,6 @@ class GroupchatControl(ChatControlBase):
...
@@ -883,7 +883,6 @@ class GroupchatControl(ChatControlBase):
text, the second, what sound to play.
'''
text, the second, what sound to play.
'''
highlight
,
sound
=
(
None
,
None
)
highlight
,
sound
=
(
None
,
None
)
# Are any of the defined highlighting words in the text?
# Are any of the defined highlighting words in the text?
if
self
.
needs_visual_notification
(
text
):
if
self
.
needs_visual_notification
(
text
):
highlight
=
True
highlight
=
True
...
@@ -1013,7 +1012,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -1013,7 +1012,8 @@ class GroupchatControl(ChatControlBase):
if
self
.
is_anonymous
and
gc_contact
.
affiliation
not
in
[
'
admin
'
,
'
owner
'
]
\
if
self
.
is_anonymous
and
gc_contact
.
affiliation
not
in
[
'
admin
'
,
'
owner
'
]
\
and
self_contact
.
affiliation
in
[
'
admin
'
,
'
owner
'
]:
and
self_contact
.
affiliation
in
[
'
admin
'
,
'
owner
'
]:
prim_text
=
_
(
'
Really send file?
'
)
prim_text
=
_
(
'
Really send file?
'
)
sec_text
=
_
(
'
If you send a file to %s, he/she will know your real Jabber ID.
'
)
%
gc_contact
.
name
sec_text
=
_
(
'
If you send a file to %s, he/she will know your real
'
'
Jabber ID.
'
)
%
gc_contact
.
name
dialog
=
dialogs
.
NonModalConfirmationDialog
(
prim_text
,
sec_text
,
dialog
=
dialogs
.
NonModalConfirmationDialog
(
prim_text
,
sec_text
,
on_response_ok
=
(
_on_send_files
,
gc_contact
))
on_response_ok
=
(
_on_send_files
,
gc_contact
))
dialog
.
popup
()
dialog
.
popup
()
...
@@ -1039,13 +1039,13 @@ class GroupchatControl(ChatControlBase):
...
@@ -1039,13 +1039,13 @@ class GroupchatControl(ChatControlBase):
if
status
and
gajim
.
config
.
get
(
'
show_status_msgs_in_roster
'
):
if
status
and
gajim
.
config
.
get
(
'
show_status_msgs_in_roster
'
):
status
=
status
.
strip
()
status
=
status
.
strip
()
if
status
!=
''
:
if
status
!=
''
:
status
=
helpers
.
reduce_chars_newlines
(
status
,
max_lines
=
1
)
status
=
helpers
.
reduce_chars_newlines
(
status
,
max_lines
=
1
)
# escape markup entities and make them small italic and fg color
# escape markup entities and make them small italic and fg color
color
=
gtkgui_helpers
.
_get_fade_color
(
self
.
list_treeview
,
color
=
gtkgui_helpers
.
_get_fade_color
(
self
.
list_treeview
,
selected
,
focus
)
selected
,
focus
)
colorstring
=
"
#%04x%04x%04x
"
%
(
color
.
red
,
color
.
green
,
color
.
blue
)
colorstring
=
"
#%04x%04x%04x
"
%
(
color
.
red
,
color
.
green
,
color
.
blue
)
name
+=
'
\n
'
'
<span size=
"
small
"
style=
"
italic
"
foreground=
"
%s
"
>%s
</span>
'
\
name
+=
'
\n
<span size=
"
small
"
style=
"
italic
"
foreground=
"
%s
"
>%s
'
%
(
colorstring
,
gobject
.
markup_escape_text
(
status
))
'
</span>
'
%
(
colorstring
,
gobject
.
markup_escape_text
(
status
))
model
[
iter_
][
C_IMG
]
=
image
model
[
iter_
][
C_IMG
]
=
image
model
[
iter_
][
C_TEXT
]
=
name
model
[
iter_
][
C_TEXT
]
=
name
...
@@ -1082,7 +1082,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -1082,7 +1082,7 @@ class GroupchatControl(ChatControlBase):
self
.
draw_role
(
role
)
self
.
draw_role
(
role
)
def
chg_contact_status
(
self
,
nick
,
show
,
status
,
role
,
affiliation
,
jid
,
def
chg_contact_status
(
self
,
nick
,
show
,
status
,
role
,
affiliation
,
jid
,
reason
,
actor
,
statusCode
,
new_nick
,
avatar_sha
,
tim
=
None
):
reason
,
actor
,
statusCode
,
new_nick
,
avatar_sha
,
tim
=
None
):
'''
When an occupant changes his or her status
'''
'''
When an occupant changes his or her status
'''
if
show
==
'
invisible
'
:
if
show
==
'
invisible
'
:
return
return
...
@@ -1131,7 +1131,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -1131,7 +1131,7 @@ class GroupchatControl(ChatControlBase):
'
nick
'
:
nick
,
'
nick
'
:
nick
,
'
who
'
:
actor
,
'
who
'
:
actor
,
'
reason
'
:
reason
}
'
reason
'
:
reason
}
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
elif
'
301
'
in
statusCode
:
elif
'
301
'
in
statusCode
:
if
actor
is
None
:
# do not print 'banned by None'
if
actor
is
None
:
# do not print 'banned by None'
s
=
_
(
'
%(nick)s has been banned: %(reason)s
'
)
%
{
s
=
_
(
'
%(nick)s has been banned: %(reason)s
'
)
%
{
...
@@ -1142,7 +1142,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -1142,7 +1142,7 @@ class GroupchatControl(ChatControlBase):
'
nick
'
:
nick
,
'
nick
'
:
nick
,
'
who
'
:
actor
,
'
who
'
:
actor
,
'
reason
'
:
reason
}
'
reason
'
:
reason
}
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
elif
'
303
'
in
statusCode
:
# Someone changed his or her nick
elif
'
303
'
in
statusCode
:
# Someone changed his or her nick
if
new_nick
==
self
.
new_nick
:
# We changed our nick
if
new_nick
==
self
.
new_nick
:
# We changed our nick
self
.
nick
=
self
.
new_nick
self
.
nick
=
self
.
new_nick
...
@@ -1187,17 +1187,17 @@ class GroupchatControl(ChatControlBase):
...
@@ -1187,17 +1187,17 @@ class GroupchatControl(ChatControlBase):
elif
'
321
'
in
statusCode
:
elif
'
321
'
in
statusCode
:
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
'
nick
'
:
nick
,
'
reason
'
:
_
(
'
affiliation changed
'
)
}
'
nick
'
:
nick
,
'
reason
'
:
_
(
'
affiliation changed
'
)
}
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
elif
'
322
'
in
statusCode
:
elif
'
322
'
in
statusCode
:
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
'
nick
'
:
nick
,
'
nick
'
:
nick
,
'
reason
'
:
_
(
'
room configuration changed to members-only
'
)
}
'
reason
'
:
_
(
'
room configuration changed to members-only
'
)
}
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
elif
'
332
'
in
statusCode
:
elif
'
332
'
in
statusCode
:
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
s
=
_
(
'
%(nick)s has been removed from the room (%(reason)s)
'
)
%
{
'
nick
'
:
nick
,
'
nick
'
:
nick
,
'
reason
'
:
_
(
'
system shutdown
'
)
}
'
reason
'
:
_
(
'
system shutdown
'
)
}
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
self
.
print_conversation
(
s
,
'
info
'
,
tim
=
tim
)
elif
'
destroyed
'
in
statusCode
:
# Room has been destroyed
elif
'
destroyed
'
in
statusCode
:
# Room has been destroyed
self
.
print_conversation
(
reason
,
'
info
'
,
tim
)
self
.
print_conversation
(
reason
,
'
info
'
,
tim
)
...
@@ -1355,9 +1355,9 @@ class GroupchatControl(ChatControlBase):
...
@@ -1355,9 +1355,9 @@ class GroupchatControl(ChatControlBase):
self
.
draw_all_roles
()
self
.
draw_all_roles
()
iter_
=
model
.
append
(
role_iter
,
(
None
,
nick
,
'
contact
'
,
name
,
None
))
iter_
=
model
.
append
(
role_iter
,
(
None
,
nick
,
'
contact
'
,
name
,
None
))
if
not
nick
in
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
self
.
room_jid
):
if
not
nick
in
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
self
.
room_jid
):
gc_contact
=
gajim
.
contacts
.
create_gc_contact
(
room_jid
=
self
.
room_jid
,
gc_contact
=
gajim
.
contacts
.
create_gc_contact
(
room_jid
=
self
.
room_jid
,
name
=
nick
,
show
=
show
,
status
=
status
,
role
=
role
,
name
=
nick
,
show
=
show
,
status
=
status
,
role
=
role
,
affiliation
=
affiliation
,
jid
=
j
,
resource
=
resource
)
affiliation
=
affiliation
,
jid
=
j
,
resource
=
resource
)
gajim
.
contacts
.
add_gc_contact
(
self
.
account
,
gc_contact
)
gajim
.
contacts
.
add_gc_contact
(
self
.
account
,
gc_contact
)
self
.
draw_contact
(
nick
)
self
.
draw_contact
(
nick
)
self
.
draw_avatar
(
nick
)
self
.
draw_avatar
(
nick
)
...
@@ -1458,7 +1458,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -1458,7 +1458,7 @@ class GroupchatControl(ChatControlBase):
nicks
=
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
self
.
room_jid
)
nicks
=
gajim
.
contacts
.
get_nick_list
(
self
.
account
,
self
.
room_jid
)
for
nick
in
(
nick0
,
nick1
):
for
nick
in
(
nick0
,
nick1
):
if
nick
in
nicks
:
if
nick
in
nicks
:
self
.
on_send_pm
(
nick
=
nick
)
self
.
on_send_pm
(
nick
=
nick
)
self
.
clear
(
self
.
msg_textview
)
self
.
clear
(
self
.
msg_textview
)
return
True
return
True
self
.
print_conversation
(
_
(
'
Nickname not found: %s
'
)
%
\
self
.
print_conversation
(
_
(
'
Nickname not found: %s
'
)
%
\
...
@@ -1505,7 +1505,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -1505,7 +1505,8 @@ class GroupchatControl(ChatControlBase):
message_array
=
message_array
[
0
].
split
()
message_array
=
message_array
[
0
].
split
()
invitee
=
message_array
.
pop
(
0
)
invitee
=
message_array
.
pop
(
0
)
reason
=
'
'
.
join
(
message_array
)
reason
=
'
'
.
join
(
message_array
)
gajim
.
connections
[
self
.
account
].
send_invite
(
self
.
room_jid
,
invitee
,
reason
)
gajim
.
connections
[
self
.
account
].
send_invite
(
self
.
room_jid
,
invitee
,
reason
)
s
=
_
(
'
Invited %(contact_jid)s to %(room_jid)s.
'
)
%
{
s
=
_
(
'
Invited %(contact_jid)s to %(room_jid)s.
'
)
%
{
'
contact_jid
'
:
invitee
,
'
contact_jid
'
:
invitee
,
'
room_jid
'
:
self
.
room_jid
}
'
room_jid
'
:
self
.
room_jid
}
...
@@ -1519,7 +1520,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -1519,7 +1520,8 @@ class GroupchatControl(ChatControlBase):
if
len
(
message_array
):
if
len
(
message_array
):
room_jid
=
message_array
[
0
]
room_jid
=
message_array
[
0
]
if
room_jid
.
find
(
'
@
'
)
<
0
:
if
room_jid
.
find
(
'
@
'
)
<
0
:
room_jid
=
room_jid
+
'
@
'
+
gajim
.
get_server_from_jid
(
self
.
room_jid
)
room_jid
=
room_jid
+
'
@
'
+
gajim
.
get_server_from_jid
(
self
.
room_jid
)
else
:
else
:
room_jid
=
'
@
'
+
gajim
.
get_server_from_jid
(
self
.
room_jid
)
room_jid
=
'
@
'
+
gajim
.
get_server_from_jid
(
self
.
room_jid
)
if
room_jid
.
find
(
'
/
'
)
>=
0
:
if
room_jid
.
find
(
'
/
'
)
>=
0
:
...
@@ -1534,7 +1536,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -1534,7 +1536,7 @@ class GroupchatControl(ChatControlBase):
try
:
try
:
gajim
.
interface
.
instances
[
self
.
account
][
'
join_gc
'
]
=
\
gajim
.
interface
.
instances
[
self
.
account
][
'
join_gc
'
]
=
\
dialogs
.
JoinGroupchatWindow
(
self
.
account
,
dialogs
.
JoinGroupchatWindow
(
self
.
account
,
room_jid
=
room_jid
,
nick
=
nick
)
room_jid
=
room_jid
,
nick
=
nick
)
except
GajimGeneralException
:
except
GajimGeneralException
:
pass
pass
self
.
clear
(
self
.
msg_textview
)
self
.
clear
(
self
.
msg_textview
)
...
@@ -1641,9 +1643,9 @@ class GroupchatControl(ChatControlBase):
...
@@ -1641,9 +1643,9 @@ class GroupchatControl(ChatControlBase):
self
.
print_conversation
(
_
(
'
Commands: %s
'
)
%
GroupchatControl
.
MUC_CMDS
,
self
.
print_conversation
(
_
(
'
Commands: %s
'
)
%
GroupchatControl
.
MUC_CMDS
,
'
info
'
)
'
info
'
)
elif
command
==
'
ban
'
:
elif
command
==
'
ban
'
:
s
=
_
(
'
Usage: /%s <nickname|JID> [reason], bans the JID from the group
chat.
'
s
=
_
(
'
Usage: /%s <nickname|JID> [reason], bans the JID from the group
'
'
The nickname of an occupant may be substituted, but not if
it
'
'
chat.
The nickname of an occupant may be substituted, but not if
'
'
contains
"
@
"
. If the JID is currently in the group chat,
'
'
it
contains
"
@
"
. If the JID is currently in the group chat,
'
'
he/she/it will also be kicked. Does NOT support spaces in
'
'
he/she/it will also be kicked. Does NOT support spaces in
'
'
nickname.
'
)
%
command
'
nickname.
'
)
%
command
self
.
print_conversation
(
s
,
'
info
'
)
self
.
print_conversation
(
s
,
'
info
'
)
...
@@ -1773,7 +1775,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -1773,7 +1775,8 @@ class GroupchatControl(ChatControlBase):
fjid
=
self
.
room_jid
+
'
/
'
+
nick
fjid
=
self
.
room_jid
+
'
/
'
+
nick
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_gc_control
(
fjid
,
self
.
account
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_gc_control
(
fjid
,
self
.
account
)
if
ctrl
:
if
ctrl
:
contact
=
gajim
.
contacts
.
get_gc_contact
(
self
.
account
,
self
.
room_jid
,
nick
)
contact
=
gajim
.
contacts
.
get_gc_contact
(
self
.
account
,
self
.
room_jid
,
nick
)
contact
.
show
=
'
offline
'
contact
.
show
=
'
offline
'
contact
.
status
=
''
contact
.
status
=
''
ctrl
.
update_ui
()
ctrl
.
update_ui
()
...
@@ -1876,7 +1879,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -1876,7 +1879,8 @@ class GroupchatControl(ChatControlBase):
if
c
.
affiliation
==
'
owner
'
:
if
c
.
affiliation
==
'
owner
'
:
gajim
.
connections
[
self
.
account
].
request_gc_config
(
self
.
room_jid
)
gajim
.
connections
[
self
.
account
].
request_gc_config
(
self
.
room_jid
)
elif
c
.
affiliation
==
'
admin
'
:
elif
c
.
affiliation
==
'
admin
'
:
if
self
.
room_jid
not
in
gajim
.
interface
.
instances
[
self
.
account
][
'
gc_config
'
]:
if
self
.
room_jid
not
in
gajim
.
interface
.
instances
[
self
.
account
][
'
gc_config
'
]:
gajim
.
interface
.
instances
[
self
.
account
][
'
gc_config
'
][
self
.
room_jid
]
\
gajim
.
interface
.
instances
[
self
.
account
][
'
gc_config
'
][
self
.
room_jid
]
\
=
config
.
GroupchatConfigWindow
(
self
.
account
,
self
.
room_jid
)
=
config
.
GroupchatConfigWindow
(
self
.
account
,
self
.
room_jid
)
...
@@ -2214,7 +2218,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -2214,7 +2218,7 @@ class GroupchatControl(ChatControlBase):
nick
=
model
[
path
][
C_NICK
].
decode
(
'
utf-8
'
)
nick
=
model
[
path
][
C_NICK
].
decode
(
'
utf-8
'
)
self
.
_start_private_message
(
nick
)
self
.
_start_private_message
(
nick
)
def
on_list_treeview_row_activated
(
self
,
widget
,
path
,
col
=
0
):
def
on_list_treeview_row_activated
(
self
,
widget
,
path
,
col
=
0
):
'''
When an iter is double clicked: open the chat window
'''
'''
When an iter is double clicked: open the chat window
'''
if
not
gajim
.
single_click
:
if
not
gajim
.
single_click
:
self
.
on_row_activated
(
widget
,
path
)
self
.
on_row_activated
(
widget
,
path
)
...
@@ -2330,7 +2334,6 @@ class GroupchatControl(ChatControlBase):
...
@@ -2330,7 +2334,6 @@ class GroupchatControl(ChatControlBase):
else
:
else
:
self
.
tooltip
.
hide_tooltip
()
self
.
tooltip
.
hide_tooltip
()
def
grant_voice
(
self
,
widget
,
nick
):
def
grant_voice
(
self
,
widget
,
nick
):
'''
grant voice privilege to a user
'''
'''
grant voice privilege to a user
'''
gajim
.
connections
[
self
.
account
].
gc_set_role
(
self
.
room_jid
,
nick
,
gajim
.
connections
[
self
.
account
].
gc_set_role
(
self
.
room_jid
,
nick
,
...
@@ -2375,7 +2378,8 @@ class GroupchatControl(ChatControlBase):
...
@@ -2375,7 +2378,8 @@ class GroupchatControl(ChatControlBase):
def
grant_admin
(
self
,
widget
,
jid
):
def
grant_admin
(
self
,
widget
,
jid
):
'''
grant administrative privilege to a user
'''
'''
grant administrative privilege to a user
'''
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
admin
'
)
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
admin
'
)
def
revoke_admin
(
self
,
widget
,
jid
):
def
revoke_admin
(
self
,
widget
,
jid
):
'''
revoke administrative privilege to a user
'''
'''
revoke administrative privilege to a user
'''
...
@@ -2384,11 +2388,13 @@ class GroupchatControl(ChatControlBase):
...
@@ -2384,11 +2388,13 @@ class GroupchatControl(ChatControlBase):
def
grant_owner
(
self
,
widget
,
jid
):
def
grant_owner
(
self
,
widget
,
jid
):
'''
grant owner privilege to a user
'''
'''
grant owner privilege to a user
'''
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
owner
'
)
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
owner
'
)
def
revoke_owner
(
self
,
widget
,
jid
):
def
revoke_owner
(
self
,
widget
,
jid
):
'''
revoke owner privilege to a user
'''
'''
revoke owner privilege to a user
'''
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
admin
'
)
gajim
.
connections
[
self
.
account
].
gc_set_affiliation
(
self
.
room_jid
,
jid
,
'
admin
'
)
def
on_info
(
self
,
widget
,
nick
):
def
on_info
(
self
,
widget
,
nick
):
'''
Call vcard_information_window class to display user
'
s information
'''
'''
Call vcard_information_window class to display user
'
s information
'''
...
@@ -2403,7 +2409,7 @@ class GroupchatControl(ChatControlBase):
...
@@ -2403,7 +2409,7 @@ class GroupchatControl(ChatControlBase):
def
on_history
(
self
,
widget
,
nick
):
def
on_history
(
self
,
widget
,
nick
):
jid
=
gajim
.
construct_fjid
(
self
.
room_jid
,
nick
)
jid
=
gajim
.
construct_fjid
(
self
.
room_jid
,
nick
)
self
.
_on_history_menuitem_activate
(
widget
=
widget
,
jid
=
jid
)
self
.
_on_history_menuitem_activate
(
widget
=
widget
,
jid
=
jid
)
def
on_add_to_roster
(
self
,
widget
,
jid
):
def
on_add_to_roster
(
self
,
widget
,
jid
):
dialogs
.
AddNewContactWindow
(
self
.
account
,
jid
)
dialogs
.
AddNewContactWindow
(
self
.
account
,
jid
)
...
...
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