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
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
mesonium
gajim
Commits
9dc44a6f
Commit
9dc44a6f
authored
4 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
PubSub: Remove unused methods
parent
f4e4596d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gajim/common/modules/pubsub.py
+6
-97
6 additions, 97 deletions
gajim/common/modules/pubsub.py
gajim/gtk/discovery.py
+3
-2
3 additions, 2 deletions
gajim/gtk/discovery.py
with
9 additions
and
99 deletions
gajim/common/modules/pubsub.py
+
6
−
97
View file @
9dc44a6f
...
@@ -30,6 +30,12 @@
...
@@ -30,6 +30,12 @@
class
PubSub
(
BaseModule
):
class
PubSub
(
BaseModule
):
_nbxmpp_extends
=
'
PubSub
'
_nbxmpp_methods
=
[
'
publish
'
,
]
def
__init__
(
self
,
con
):
def
__init__
(
self
,
con
):
BaseModule
.
__init__
(
self
,
con
)
BaseModule
.
__init__
(
self
,
con
)
...
@@ -71,86 +77,6 @@ def send_pb_unsubscribe(self, jid, node, cb, **kwargs):
...
@@ -71,86 +77,6 @@ def send_pb_unsubscribe(self, jid, node, cb, **kwargs):
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
def
send_pb_publish
(
self
,
jid
,
node
,
item
,
id_
=
None
,
options
=
None
,
cb
=
None
,
**
kwargs
):
if
not
app
.
account_is_available
(
self
.
_account
):
return
if
cb
is
None
:
cb
=
self
.
_default_callback
query
=
nbxmpp
.
Iq
(
'
set
'
,
to
=
jid
)
pubsub
=
query
.
addChild
(
'
pubsub
'
,
namespace
=
Namespace
.
PUBSUB
)
publish
=
pubsub
.
addChild
(
'
publish
'
,
{
'
node
'
:
node
})
attrs
=
{}
if
id_
:
attrs
=
{
'
id
'
:
id_
}
publish
.
addChild
(
'
item
'
,
attrs
,
[
item
])
if
options
:
publish
=
pubsub
.
addChild
(
'
publish-options
'
)
publish
.
addChild
(
node
=
options
)
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
@staticmethod
def
get_pb_retrieve_iq
(
jid
,
node
,
item_id
=
None
):
"""
Get IQ to query items from a node
"""
query
=
nbxmpp
.
Iq
(
'
get
'
,
to
=
jid
)
pubsub
=
query
.
addChild
(
'
pubsub
'
,
namespace
=
Namespace
.
PUBSUB
)
items
=
pubsub
.
addChild
(
'
items
'
,
{
'
node
'
:
node
})
if
item_id
is
not
None
:
items
.
addChild
(
'
item
'
,
{
'
id
'
:
item_id
})
return
query
def
send_pb_retrieve
(
self
,
jid
,
node
,
item_id
=
None
,
cb
=
None
,
**
kwargs
):
"""
Get items from a node
"""
if
not
app
.
account_is_available
(
self
.
_account
):
return
if
cb
is
None
:
cb
=
self
.
_default_callback
query
=
self
.
get_pb_retrieve_iq
(
jid
,
node
,
item_id
)
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
def
send_pb_retract
(
self
,
jid
,
node
,
id_
,
cb
=
None
,
**
kwargs
):
"""
Delete item from a node
"""
if
not
app
.
account_is_available
(
self
.
_account
):
return
if
cb
is
None
:
cb
=
self
.
_default_callback
query
=
nbxmpp
.
Iq
(
'
set
'
,
to
=
jid
)
pubsub
=
query
.
addChild
(
'
pubsub
'
,
namespace
=
Namespace
.
PUBSUB
)
retract
=
pubsub
.
addChild
(
'
retract
'
,
{
'
node
'
:
node
,
'
notify
'
:
'
1
'
})
retract
.
addChild
(
'
item
'
,
{
'
id
'
:
id_
})
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
def
send_pb_purge
(
self
,
jid
,
node
,
cb
=
None
,
**
kwargs
):
"""
Purge node: Remove all items
"""
if
not
app
.
account_is_available
(
self
.
_account
):
return
if
cb
is
None
:
cb
=
self
.
_default_callback
query
=
nbxmpp
.
Iq
(
'
set
'
,
to
=
jid
)
pubsub
=
query
.
addChild
(
'
pubsub
'
,
namespace
=
Namespace
.
PUBSUB_OWNER
)
pubsub
.
addChild
(
'
purge
'
,
{
'
node
'
:
node
})
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
,
kwargs
)
def
send_pb_delete
(
self
,
jid
,
node
,
on_ok
=
None
,
on_fail
=
None
):
def
send_pb_delete
(
self
,
jid
,
node
,
on_ok
=
None
,
on_fail
=
None
):
"""
"""
Delete node
Delete node
...
@@ -171,23 +97,6 @@ def response(_nbxmpp_client, resp, jid, node):
...
@@ -171,23 +97,6 @@ def response(_nbxmpp_client, resp, jid, node):
self
.
_con
.
connection
.
SendAndCallForResponse
(
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
response
,
{
'
jid
'
:
jid
,
'
node
'
:
node
})
query
,
response
,
{
'
jid
'
:
jid
,
'
node
'
:
node
})
def
send_pb_create
(
self
,
jid
,
node
,
cb
,
configure
=
False
,
configure_form
=
None
):
"""
Create a new node
"""
if
not
app
.
account_is_available
(
self
.
_account
):
return
query
=
nbxmpp
.
Iq
(
'
set
'
,
to
=
jid
)
pubsub
=
query
.
addChild
(
'
pubsub
'
,
namespace
=
Namespace
.
PUBSUB
)
create
=
pubsub
.
addChild
(
'
create
'
,
{
'
node
'
:
node
})
if
configure
:
conf
=
create
.
addChild
(
'
configure
'
)
if
configure_form
is
not
None
:
conf
.
addChild
(
node
=
configure_form
)
self
.
_con
.
connection
.
SendAndCallForResponse
(
query
,
cb
)
def
send_pb_configure
(
self
,
jid
,
node
,
form
,
cb
=
None
,
**
kwargs
):
def
send_pb_configure
(
self
,
jid
,
node
,
form
,
cb
=
None
,
**
kwargs
):
if
not
app
.
account_is_available
(
self
.
_account
):
if
not
app
.
account_is_available
(
self
.
_account
):
return
return
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/discovery.py
+
3
−
2
View file @
9dc44a6f
...
@@ -2190,8 +2190,9 @@ def _on_send_button_clicked(self, w):
...
@@ -2190,8 +2190,9 @@ def _on_send_button_clicked(self, w):
# Publish it to node
# Publish it to node
con
=
app
.
connections
[
self
.
account
]
con
=
app
.
connections
[
self
.
account
]
con
.
get_module
(
'
PubSub
'
).
send_pb_publish
(
con
.
get_module
(
'
PubSub
'
).
publish
(
self
.
groupid
,
self
.
servicejid
,
self
.
groupid
,
item
,
str
(
uuid
.
uuid4
()))
item
,
jid
=
self
.
servicejid
)
# Close the window
# Close the window
self
.
window
.
destroy
()
self
.
window
.
destroy
()
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