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
beb32a3d
Commit
beb32a3d
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
handle error messages correctly. Fixes #4783
parent
6f951d20
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
src/chat_control.py
+21
-12
21 additions, 12 deletions
src/chat_control.py
src/conversation_textview.py
+1
-1
1 addition, 1 deletion
src/conversation_textview.py
src/session.py
+12
-7
12 additions, 7 deletions
src/session.py
with
34 additions
and
20 deletions
src/chat_control.py
+
21
−
12
View file @
beb32a3d
...
...
@@ -134,7 +134,9 @@ class ChatControlBase(MessageControl):
def
handle_message_textview_mykey_press
(
self
,
widget
,
event_keyval
,
event_keymod
):
pass
# Derived should implement this rather than connecting to the event itself.
# Derived should implement this rather than connecting to the event
# itself.
pass
def
status_url_clicked
(
self
,
widget
,
url
):
helpers
.
launch_browser_mailer
(
'
url
'
,
url
)
...
...
@@ -167,12 +169,14 @@ class ChatControlBase(MessageControl):
self
.
_on_banner_eventbox_button_press_event
)
self
.
handlers
[
id_
]
=
widget
self
.
urlfinder
=
re
.
compile
(
r
"
(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>
'
\"]+[^!,\.\s<>\)
'
\"\]]
"
)
self
.
urlfinder
=
re
.
compile
(
r
"
(www\.(?!\.)|[a-z][a-z0-9+.-]*://)[^\s<>
'
\"]+[^!,\.\s<>\)
'
\"\]]
"
)
if
gajim
.
HAVE_PYSEXY
:
import
sexy
self
.
banner_status_label
=
sexy
.
UrlLabel
()
self
.
banner_status_label
.
connect
(
'
url_activated
'
,
self
.
status_url_clicked
)
self
.
banner_status_label
.
connect
(
'
url_activated
'
,
self
.
status_url_clicked
)
else
:
self
.
banner_status_label
=
gtk
.
Label
()
self
.
banner_status_label
.
set_selectable
(
True
)
...
...
@@ -314,7 +318,8 @@ class ChatControlBase(MessageControl):
dialogs
.
AspellDictError
(
lang
)
def
on_msg_textview_populate_popup
(
self
,
textview
,
menu
):
'''
we override the default context menu and we prepend an option to switch languages
'''
'''
we override the default context menu and we prepend an option to switch
languages
'''
def
_on_select_dictionary
(
widget
,
lang
):
per_type
=
'
contacts
'
if
self
.
type_id
==
message_control
.
TYPE_GC
:
...
...
@@ -664,7 +669,7 @@ class ChatControlBase(MessageControl):
# other_tags_for_text == ['marked'] --> highlighted gc message
gajim
.
last_message_time
[
self
.
account
][
full_jid
]
=
time
.
time
()
if
kind
in
(
'
incoming
'
,
'
incoming_queue
'
):
if
kind
in
(
'
incoming
'
,
'
incoming_queue
'
,
'
error
'
):
gc_message
=
False
if
self
.
type_id
==
message_control
.
TYPE_GC
:
gc_message
=
True
...
...
@@ -674,7 +679,7 @@ class ChatControlBase(MessageControl):
not
self
.
parent_win
.
is_active
()
or
not
end
))
or
\
(
gc_message
and
\
jid
in
gajim
.
interface
.
minimized_controls
[
self
.
account
]))
and
\
kind
in
(
'
incoming
'
,
'
incoming_queue
'
):
kind
in
(
'
incoming
'
,
'
incoming_queue
'
,
'
error
'
):
# we want to have save this message in events list
# other_tags_for_text == ['marked'] --> highlighted gc message
if
gc_message
:
...
...
@@ -706,7 +711,7 @@ class ChatControlBase(MessageControl):
if
(
not
self
.
parent_win
.
get_active_control
()
or
\
self
!=
self
.
parent_win
.
get_active_control
()
or
\
not
self
.
parent_win
.
is_active
()
or
not
end
)
and
\
kind
in
(
'
incoming
'
,
'
incoming_queue
'
):
kind
in
(
'
incoming
'
,
'
incoming_queue
'
,
'
error
'
):
self
.
parent_win
.
redraw_tab
(
self
)
if
not
self
.
parent_win
.
is_active
():
self
.
parent_win
.
show_title
(
True
,
self
)
# Enabled Urgent hint
...
...
@@ -1902,12 +1907,13 @@ class ChatControl(ChatControlBase):
def
print_conversation
(
self
,
text
,
frm
=
''
,
tim
=
None
,
encrypted
=
False
,
subject
=
None
,
xhtml
=
None
,
simple
=
False
,
xep0184_id
=
None
):
# TODO: contact? ITYM frm.
'''
Print a line in the conversation:
if contact is set to status: it
'
s a status message
if contact is set to another value: it
'
s an outgoing message
if contact is set to print_queue: it is incomming from queue
if contact is not set: it
'
s an incomming message
'''
if frm is set to status: it
'
s a status message
if frm is set to error: it
'
s an error message
if frm is set to info: it
'
s a information message
if frm is set to print_queue: it is incomming from queue
if frm is set to another value: it
'
s an outgoing message
if frm is not set: it
'
s an incomming message
'''
contact
=
self
.
contact
if
frm
==
'
status
'
:
...
...
@@ -1915,6 +1921,9 @@ class ChatControl(ChatControlBase):
return
kind
=
'
status
'
name
=
''
elif
frm
==
'
error
'
:
kind
=
'
error
'
name
=
''
elif
frm
==
'
info
'
:
kind
=
'
info
'
name
=
''
...
...
This diff is collapsed.
Click to expand it.
src/conversation_textview.py
+
1
−
1
View file @
beb32a3d
...
...
@@ -1154,7 +1154,7 @@ class ConversationTextview:
buffer_
.
insert_with_tags_by_name
(
end_iter
,
tim_format
+
'
\n
'
,
'
time_sometimes
'
)
# kind = info, we print things as if it was a status: same color, ...
if
kind
==
'
info
'
:
if
kind
in
(
'
error
'
,
'
info
'
)
:
kind
=
'
status
'
other_text_tag
=
self
.
detect_other_text_tag
(
text
,
kind
)
text_tags
=
other_tags_for_text
[:]
# create a new list
...
...
This diff is collapsed.
Click to expand it.
src/session.py
+
12
−
7
View file @
beb32a3d
...
...
@@ -296,12 +296,17 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
self
.
conn
.
name
,
jid
,
user_nick
)
if
not
self
.
control
:
# if no control exists and message comes from highest prio, the new
# control shouldn't have a resource
if
highest_contact
and
contact
.
resource
==
highest_contact
.
resource
\
and
not
jid
==
gajim
.
get_jid_from_account
(
self
.
conn
.
name
):
fjid
=
jid
resource_for_chat
=
None
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
fjid
,
self
.
conn
.
name
)
if
ctrl
:
self
.
control
=
ctrl
self
.
control
.
set_session
(
self
)
else
:
# if no control exists and message comes from highest prio, the new
# control shouldn't have a resource
if
highest_contact
and
contact
.
resource
==
highest_contact
.
resource
\
and
not
jid
==
gajim
.
get_jid_from_account
(
self
.
conn
.
name
):
fjid
=
jid
resource_for_chat
=
None
# Do we have a queue?
no_queue
=
len
(
gajim
.
events
.
get_events
(
self
.
conn
.
name
,
fjid
))
==
0
...
...
@@ -319,7 +324,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
typ
=
''
if
msg_type
==
'
error
'
:
typ
=
'
status
'
typ
=
'
error
'
self
.
control
.
print_conversation
(
msg
,
typ
,
tim
=
tim
,
encrypted
=
encrypted
,
subject
=
subject
,
xhtml
=
xhtml
)
...
...
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