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
99
Issues
99
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
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
dfc0793e
Commit
dfc0793e
authored
Oct 11, 2016
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include a private and no-copy nodes in private <message/> to avoid carbon duplication
parent
548e4ad4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
louloulibs/xmpp/xmpp_component.cpp
louloulibs/xmpp/xmpp_component.cpp
+14
-1
louloulibs/xmpp/xmpp_component.hpp
louloulibs/xmpp/xmpp_component.hpp
+2
-3
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+3
-3
No files found.
louloulibs/xmpp/xmpp_component.cpp
View file @
dfc0793e
...
...
@@ -273,7 +273,8 @@ void* XmppComponent::get_receive_buffer(const size_t size) const
return
this
->
parser
.
get_buffer
(
size
);
}
void
XmppComponent
::
send_message
(
const
std
::
string
&
from
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
to
,
const
std
::
string
&
type
,
const
bool
fulljid
)
void
XmppComponent
::
send_message
(
const
std
::
string
&
from
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
to
,
const
std
::
string
&
type
,
const
bool
fulljid
,
const
bool
nocopy
)
{
XmlNode
node
(
"message"
);
node
[
"to"
]
=
to
;
...
...
@@ -294,6 +295,18 @@ void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, con
html
.
add_child
(
std
::
move
(
std
::
get
<
1
>
(
body
)));
node
.
add_child
(
std
::
move
(
html
));
}
if
(
nocopy
)
{
XmlNode
private_node
(
"private"
);
private_node
[
"xmlns"
]
=
"urn:xmpp:carbons:2"
;
node
.
add_child
(
std
::
move
(
private_node
));
XmlNode
nocopy
(
"no-copy"
);
nocopy
[
"xmlns"
]
=
"urn:xmpp:hints"
;
node
.
add_child
(
std
::
move
(
nocopy
));
}
this
->
send_stanza
(
node
);
}
...
...
louloulibs/xmpp/xmpp_component.hpp
View file @
dfc0793e
...
...
@@ -109,9 +109,8 @@ public:
* If fulljid is false, the provided 'from' doesn't contain the
* server-part of the JID and must be added.
*/
void
send_message
(
const
std
::
string
&
from
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
to
,
const
std
::
string
&
type
,
const
bool
fulljid
=
false
);
void
send_message
(
const
std
::
string
&
from
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
to
,
const
std
::
string
&
type
,
const
bool
fulljid
,
const
bool
nocopy
=
false
);
/**
* Send a join from a new participant
*/
...
...
src/bridge/bridge.cpp
View file @
dfc0793e
...
...
@@ -771,13 +771,13 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st
const
auto
chan_name
=
Iid
(
Jid
(
it
->
second
).
local
,
{}).
get_local
();
for
(
const
auto
&
resource
:
this
->
resources_in_chan
[
ChannelKey
{
chan_name
,
iid
.
get_server
()}])
this
->
xmpp
.
send_message
(
it
->
second
,
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
,
"chat"
,
true
);
this
->
user_jid
+
"/"
+
resource
,
"chat"
,
true
,
true
);
}
else
{
for
(
const
auto
&
resource
:
this
->
resources_in_server
[
iid
.
get_server
()])
this
->
xmpp
.
send_message
(
std
::
to_string
(
iid
),
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
,
"chat"
,
false
);
this
->
user_jid
+
"/"
+
resource
,
"chat"
,
false
,
true
);
}
}
}
...
...
@@ -835,7 +835,7 @@ void Bridge::send_xmpp_message(const std::string& from, const std::string& autho
const
auto
encoding
=
in_encoding_for
(
*
this
,
{
from
,
this
});
for
(
const
auto
&
resource
:
this
->
resources_in_server
[
from
])
{
this
->
xmpp
.
send_message
(
from
,
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
,
"chat"
);
this
->
xmpp
.
send_message
(
from
,
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
,
"chat"
,
false
,
false
);
}
}
...
...
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