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
a53e906a
Commit
a53e906a
authored
15 years ago
by
steve-e
Browse files
Options
Downloads
Patches
Plain Diff
Ignore error <message /> stanzas with event tag.
This prevents dialogs poping up with showing "Service unavailable".
parent
22ab1c95
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/common/pep.py
+21
-22
21 additions, 22 deletions
src/common/pep.py
with
21 additions
and
22 deletions
src/common/pep.py
+
21
−
22
View file @
a53e906a
...
...
@@ -23,9 +23,6 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
import
common.gajim
from
common
import
xmpp
MOODS
=
{
'
afraid
'
:
_
(
'
Afraid
'
),
'
amazed
'
:
_
(
'
Amazed
'
),
...
...
@@ -194,16 +191,18 @@ ACTIVITIES = {
TUNE_DATA
=
[
'
artist
'
,
'
title
'
,
'
source
'
,
'
track
'
,
'
length
'
]
import
gobject
import
gtk
import
logging
log
=
logging
.
getLogger
(
'
gajim.c.pep
'
)
import
helpers
import
atom
import
gtkgui_helpers
import
gobject
import
gajim
import
gtk
from
common
import
helpers
from
common
import
atom
from
common
import
xmpp
from
common
import
gajim
import
gtkgui_helpers
def
translate_mood
(
mood
):
if
mood
in
MOODS
:
...
...
@@ -230,7 +229,7 @@ class AbstractPEP(object):
self
.
_pep_specific_data
,
self
.
_retracted
=
self
.
_extract_info
(
items
)
self
.
_update_contacts
(
jid
,
account
)
if
jid
==
common
.
gajim
.
get_jid_from_account
(
account
):
if
jid
==
gajim
.
get_jid_from_account
(
account
):
self
.
_update_account
(
account
)
def
_extract_info
(
self
,
items
):
...
...
@@ -238,7 +237,7 @@ class AbstractPEP(object):
raise
NotImplementedError
def
_update_contacts
(
self
,
jid
,
account
):
for
contact
in
common
.
gajim
.
contacts
.
get_contacts
(
account
,
jid
):
for
contact
in
gajim
.
contacts
.
get_contacts
(
account
,
jid
):
if
self
.
_retracted
:
if
self
.
type
in
contact
.
pep
:
del
contact
.
pep
[
self
.
type
]
...
...
@@ -246,7 +245,7 @@ class AbstractPEP(object):
contact
.
pep
[
self
.
type
]
=
self
def
_update_account
(
self
,
account
):
acc
=
common
.
gajim
.
connections
[
account
]
acc
=
gajim
.
connections
[
account
]
if
self
.
_retracted
:
if
self
.
type
in
acc
.
pep
:
del
acc
.
pep
[
self
.
type
]
...
...
@@ -266,7 +265,7 @@ class UserMoodPEP(AbstractPEP):
'''
XEP-0107: User Mood
'''
type
=
'
mood
'
namespace
=
common
.
xmpp
.
NS_MOOD
namespace
=
xmpp
.
NS_MOOD
def
_extract_info
(
self
,
items
):
mood_dict
=
{}
...
...
@@ -306,7 +305,7 @@ class UserTunePEP(AbstractPEP):
'''
XEP-0118: User Tune
'''
type
=
'
tune
'
namespace
=
common
.
xmpp
.
NS_TUNE
namespace
=
xmpp
.
NS_TUNE
def
_extract_info
(
self
,
items
):
tune_dict
=
{}
...
...
@@ -352,7 +351,7 @@ class UserActivityPEP(AbstractPEP):
'''
XEP-0108: User Activity
'''
type
=
'
activity
'
namespace
=
common
.
xmpp
.
NS_ACTIVITY
namespace
=
xmpp
.
NS_ACTIVITY
def
_extract_info
(
self
,
items
):
activity_dict
=
{}
...
...
@@ -418,7 +417,7 @@ class UserNicknamePEP(AbstractPEP):
'''
XEP-0172: User Nickname
'''
type
=
'
nickname
'
namespace
=
common
.
xmpp
.
NS_NICK
namespace
=
xmpp
.
NS_NICK
def
_extract_info
(
self
,
items
):
nick
=
''
...
...
@@ -434,16 +433,16 @@ class UserNicknamePEP(AbstractPEP):
def
_update_contacts
(
self
,
jid
,
account
):
# TODO: use dict instead
nick
=
''
if
self
.
_retracted
else
self
.
_pep_specific_data
for
contact
in
common
.
gajim
.
contacts
.
get_contacts
(
account
,
jid
):
for
contact
in
gajim
.
contacts
.
get_contacts
(
account
,
jid
):
contact
.
contact_name
=
nick
def
_update_account
(
self
,
account
):
# TODO: use dict instead
if
self
.
_retracted
:
common
.
gajim
.
nicks
[
account
]
=
common
.
gajim
.
config
.
get_per
(
'
accounts
'
,
gajim
.
nicks
[
account
]
=
gajim
.
config
.
get_per
(
'
accounts
'
,
account
,
'
name
'
)
else
:
common
.
gajim
.
nicks
[
account
]
=
self
.
_pep_specific_data
gajim
.
nicks
[
account
]
=
self
.
_pep_specific_data
SUPPORTED_PERSONAL_USER_EVENTS
=
[
UserMoodPEP
,
UserTunePEP
,
UserActivityPEP
,
...
...
@@ -454,8 +453,8 @@ class ConnectionPEP(object):
def
_pubsubEventCB
(
self
,
xmpp_dispatcher
,
msg
):
'''
Called when we receive <message /> with pubsub event.
'''
if
msg
.
getTag
(
'
error
'
):
log
.
warnin
g
(
'
PubsubEventCB received error stanza
'
)
r
eturn
log
.
debu
g
(
'
PubsubEventCB received error stanza
. Ignoring
'
)
r
aise
NodeProcessed
jid
=
helpers
.
get_full_jid_from_iq
(
msg
)
event_tag
=
msg
.
getTag
(
'
event
'
)
...
...
@@ -474,7 +473,7 @@ class ConnectionPEP(object):
# but to be sure...
self
.
dispatch
(
'
ATOM_ENTRY
'
,
(
atom
.
OldEntry
(
node
=
entry
),))
raise
common
.
xmpp
.
NodeProcessed
raise
xmpp
.
NodeProcessed
def
send_activity
(
self
,
activity
,
subactivity
=
None
,
message
=
None
):
if
not
self
.
pep_supported
:
...
...
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