Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
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
Timo Ley
synapse
Commits
fa87c981
Commit
fa87c981
authored
8 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Thread 3PU lookup through as far as the AS API object; which currently noöps it
parent
e3e3fbc2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/appservice/api.py
+3
-0
3 additions, 0 deletions
synapse/appservice/api.py
synapse/handlers/appservice.py
+21
-0
21 additions, 0 deletions
synapse/handlers/appservice.py
synapse/rest/client/v2_alpha/thirdparty.py
+9
-2
9 additions, 2 deletions
synapse/rest/client/v2_alpha/thirdparty.py
with
33 additions
and
2 deletions
synapse/appservice/api.py
+
3
−
0
View file @
fa87c981
...
@@ -71,6 +71,9 @@ class ApplicationServiceApi(SimpleHttpClient):
...
@@ -71,6 +71,9 @@ class ApplicationServiceApi(SimpleHttpClient):
logger
.
warning
(
"
query_alias to %s threw exception %s
"
,
uri
,
ex
)
logger
.
warning
(
"
query_alias to %s threw exception %s
"
,
uri
,
ex
)
defer
.
returnValue
(
False
)
defer
.
returnValue
(
False
)
def
query_3pu
(
self
,
service
,
protocol
,
fields
):
return
False
@defer.inlineCallbacks
@defer.inlineCallbacks
def
push_bulk
(
self
,
service
,
events
,
txn_id
=
None
):
def
push_bulk
(
self
,
service
,
events
,
txn_id
=
None
):
events
=
self
.
_serialize
(
events
)
events
=
self
.
_serialize
(
events
)
...
...
This diff is collapsed.
Click to expand it.
synapse/handlers/appservice.py
+
21
−
0
View file @
fa87c981
...
@@ -120,6 +120,21 @@ class ApplicationServicesHandler(object):
...
@@ -120,6 +120,21 @@ class ApplicationServicesHandler(object):
)
)
defer
.
returnValue
(
result
)
defer
.
returnValue
(
result
)
@defer.inlineCallbacks
def
query_3pu
(
self
,
protocol
,
fields
):
services
=
yield
self
.
_get_services_for_3pn
(
protocol
)
# TODO(paul): scattergather
results
=
[]
for
service
in
services
:
result
=
yield
self
.
appservice_api
.
query_3pu
(
service
,
protocol
,
fields
)
if
result
:
results
.
append
(
result
)
defer
.
returnValue
(
results
)
@defer.inlineCallbacks
@defer.inlineCallbacks
def
_get_services_for_event
(
self
,
event
,
restrict_to
=
""
,
alias_list
=
None
):
def
_get_services_for_event
(
self
,
event
,
restrict_to
=
""
,
alias_list
=
None
):
"""
Retrieve a list of application services interested in this event.
"""
Retrieve a list of application services interested in this event.
...
@@ -163,6 +178,12 @@ class ApplicationServicesHandler(object):
...
@@ -163,6 +178,12 @@ class ApplicationServicesHandler(object):
]
]
defer
.
returnValue
(
interested_list
)
defer
.
returnValue
(
interested_list
)
@defer.inlineCallbacks
def
_get_services_for_3pn
(
self
,
protocol
):
# TODO(paul): Filter by protocol
services
=
yield
self
.
store
.
get_app_services
()
defer
.
returnValue
(
services
)
@defer.inlineCallbacks
@defer.inlineCallbacks
def
_is_unknown_user
(
self
,
user_id
):
def
_is_unknown_user
(
self
,
user_id
):
if
not
self
.
is_mine_id
(
user_id
):
if
not
self
.
is_mine_id
(
user_id
):
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/client/v2_alpha/thirdparty.py
+
9
−
2
View file @
fa87c981
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
import
logging
import
logging
from
twisted.internet
import
defer
from
synapse.http.servlet
import
RestServlet
from
synapse.http.servlet
import
RestServlet
from
._base
import
client_v2_patterns
from
._base
import
client_v2_patterns
...
@@ -28,10 +30,15 @@ class ThirdPartyUserServlet(RestServlet):
...
@@ -28,10 +30,15 @@ class ThirdPartyUserServlet(RestServlet):
def
__init__
(
self
,
hs
):
def
__init__
(
self
,
hs
):
super
(
ThirdPartyUserServlet
,
self
).
__init__
()
super
(
ThirdPartyUserServlet
,
self
).
__init__
()
pass
self
.
appservice_handler
=
hs
.
get_application_service_handler
()
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
protocol
):
def
on_GET
(
self
,
request
,
protocol
):
return
(
200
,
{
"
TODO
"
:
"
TODO
"
})
fields
=
{}
# TODO
results
=
yield
self
.
appservice_handler
.
query_3pu
(
protocol
,
fields
)
defer
.
returnValue
((
200
,
results
))
def
register_servlets
(
hs
,
http_server
):
def
register_servlets
(
hs
,
http_server
):
...
...
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