Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
44b72b74
Commit
44b72b74
authored
Mar 28, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The absence of a from attribute is an unrecoverable error, just ignore it
parent
3c5f8236
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+21
-9
No files found.
src/xmpp/xmpp_component.cpp
View file @
44b72b74
...
...
@@ -255,12 +255,16 @@ void XmppComponent::handle_handshake(const Stanza& stanza)
void
XmppComponent
::
handle_presence
(
const
Stanza
&
stanza
)
{
std
::
string
from
;
std
::
string
id
;
try
{
id
=
stanza
[
"id"
];
from
=
stanza
[
"from"
];
}
catch
(
const
AttributeNotFound
&
)
{}
utils
::
ScopeGuard
malformed_stanza_error
([
this
,
&
id
](){
this
->
send_stanza_error
(
"presence"
,
""
,
this
->
served_hostname
,
id
,
if
(
from
.
empty
())
return
;
utils
::
ScopeGuard
malformed_stanza_error
([
&
](){
this
->
send_stanza_error
(
"presence"
,
from
,
this
->
served_hostname
,
id
,
"modify"
,
"bad-request"
,
""
);
});
Bridge
*
bridge
=
this
->
get_user_bridge
(
stanza
[
"from"
]);
...
...
@@ -281,7 +285,7 @@ void XmppComponent::handle_presence(const Stanza& stanza)
// stanza_error.disable() call at the end of the function.
std
::
string
error_type
(
"cancel"
);
std
::
string
error_name
(
"internal-server-error"
);
utils
::
ScopeGuard
stanza_error
([
this
,
&
stanza
,
&
error_type
,
&
error_name
,
&
id
](){
utils
::
ScopeGuard
stanza_error
([
&
](){
this
->
send_stanza_error
(
"presence"
,
stanza
[
"from"
],
stanza
[
"to"
],
id
,
error_type
,
error_name
,
""
);
});
...
...
@@ -312,12 +316,16 @@ void XmppComponent::handle_presence(const Stanza& stanza)
void
XmppComponent
::
handle_message
(
const
Stanza
&
stanza
)
{
std
::
string
from
;
std
::
string
id
;
try
{
id
=
stanza
[
"id"
];
from
=
stanza
[
"from"
];
}
catch
(
const
AttributeNotFound
&
)
{}
utils
::
ScopeGuard
malformed_stanza_error
([
this
,
&
id
](){
this
->
send_stanza_error
(
"message"
,
""
,
this
->
served_hostname
,
id
,
if
(
from
.
empty
())
return
;
utils
::
ScopeGuard
malformed_stanza_error
([
&
](){
this
->
send_stanza_error
(
"message"
,
from
,
this
->
served_hostname
,
id
,
"modify"
,
"bad-request"
,
""
);
});
Bridge
*
bridge
=
this
->
get_user_bridge
(
stanza
[
"from"
]);
...
...
@@ -332,7 +340,7 @@ void XmppComponent::handle_message(const Stanza& stanza)
std
::
string
error_type
(
"cancel"
);
std
::
string
error_name
(
"internal-server-error"
);
utils
::
ScopeGuard
stanza_error
([
this
,
&
stanza
,
&
error_type
,
&
error_name
,
&
id
](){
utils
::
ScopeGuard
stanza_error
([
&
](){
this
->
send_stanza_error
(
"message"
,
stanza
[
"from"
],
stanza
[
"to"
],
id
,
error_type
,
error_name
,
""
);
});
...
...
@@ -357,11 +365,15 @@ void XmppComponent::handle_message(const Stanza& stanza)
void
XmppComponent
::
handle_iq
(
const
Stanza
&
stanza
)
{
std
::
string
id
;
std
::
string
from
;
try
{
id
=
stanza
[
"id"
];
from
=
stanza
[
"from"
];
}
catch
(
const
AttributeNotFound
&
)
{}
utils
::
ScopeGuard
malformed_stanza_error
([
this
,
&
id
](){
this
->
send_stanza_error
(
"iq"
,
""
,
this
->
served_hostname
,
id
,
if
(
from
.
empty
())
return
;
utils
::
ScopeGuard
malformed_stanza_error
([
&
](){
this
->
send_stanza_error
(
"iq"
,
from
,
this
->
served_hostname
,
id
,
"modify"
,
"bad-request"
,
""
);
});
Bridge
*
bridge
=
this
->
get_user_bridge
(
stanza
[
"from"
]);
...
...
@@ -371,7 +383,7 @@ void XmppComponent::handle_iq(const Stanza& stanza)
std
::
string
error_type
(
"cancel"
);
std
::
string
error_name
(
"internal-server-error"
);
utils
::
ScopeGuard
stanza_error
([
this
,
&
stanza
,
&
error_type
,
&
error_name
,
&
id
](){
utils
::
ScopeGuard
stanza_error
([
&
](){
this
->
send_stanza_error
(
"iq"
,
stanza
[
"from"
],
stanza
[
"to"
],
id
,
error_type
,
error_name
,
""
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment