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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alexpham
biboumi
Commits
7f2127a7
Commit
7f2127a7
authored
Mar 30, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the archive ID to messages when they are sent to users
This makes us compatible with mam 6.0 fix
#3249
parent
1090f3ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
15 deletions
+36
-15
CHANGELOG.rst
CHANGELOG.rst
+1
-0
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+6
-5
src/database/database.cpp
src/database/database.cpp
+9
-5
src/database/database.hpp
src/database/database.hpp
+1
-1
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+10
-1
src/xmpp/xmpp_component.hpp
src/xmpp/xmpp_component.hpp
+3
-1
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+6
-2
No files found.
CHANGELOG.rst
View file @
7f2127a7
...
...
@@ -10,6 +10,7 @@ Version 5.0
an IRC bouncer.
- Use the udns library instead of c-ares, for asynchronous DNS resolution.
It’s still fully optional.
- Update MAM implementation to version 6.0 (namespace mam:2)
Version 4.1 - 2017-03-21
========================
...
...
src/bridge/bridge.cpp
View file @
7f2127a7
...
...
@@ -254,15 +254,16 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body)
else
irc
->
send_channel_message
(
iid
.
get_local
(),
line
);
std
::
string
uuid
;
#ifdef USE_DATABASE
const
auto
xmpp_body
=
this
->
make_xmpp_body
(
line
);
if
(
this
->
record_history
)
Database
::
store_muc_message
(
this
->
get_bare_jid
(),
iid
,
std
::
chrono
::
system_clock
::
now
(),
uuid
=
Database
::
store_muc_message
(
this
->
get_bare_jid
(),
iid
,
std
::
chrono
::
system_clock
::
now
(),
std
::
get
<
0
>
(
xmpp_body
),
irc
->
get_own_nick
());
#endif
for
(
const
auto
&
resource
:
this
->
resources_in_chan
[
iid
.
to_tuple
()])
this
->
xmpp
.
send_muc_message
(
std
::
to_string
(
iid
),
irc
->
get_own_nick
(),
this
->
make_xmpp_body
(
line
),
this
->
user_jid
+
"/"
+
resource
);
this
->
xmpp
.
send_muc_message
(
std
::
to_string
(
iid
),
irc
->
get_own_nick
(),
this
->
make_xmpp_body
(
line
),
this
->
user_jid
+
"/"
+
resource
,
uuid
);
}
}
...
...
@@ -839,8 +840,8 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st
#endif
for
(
const
auto
&
resource
:
this
->
resources_in_chan
[
iid
.
to_tuple
()])
{
this
->
xmpp
.
send_muc_message
(
std
::
to_string
(
iid
),
nick
,
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
);
this
->
xmpp
.
send_muc_message
(
std
::
to_string
(
iid
),
nick
,
this
->
make_xmpp_body
(
body
,
encoding
),
this
->
user_jid
+
"/"
+
resource
,
{}
);
}
}
...
...
src/database/database.cpp
View file @
7f2127a7
...
...
@@ -119,14 +119,16 @@ db::IrcChannelOptions Database::get_irc_channel_options_with_server_and_global_d
return
coptions
;
}
void
Database
::
store_muc_message
(
const
std
::
string
&
owner
,
const
Iid
&
iid
,
Database
::
time_point
date
,
const
std
::
string
&
body
,
const
std
::
string
&
nick
)
std
::
string
Database
::
store_muc_message
(
const
std
::
string
&
owner
,
const
Iid
&
iid
,
Database
::
time_point
date
,
const
std
::
string
&
body
,
const
std
::
string
&
nick
)
{
db
::
MucLogLine
line
(
*
Database
::
db
);
line
.
uuid
=
Database
::
gen_uuid
();
auto
uuid
=
Database
::
gen_uuid
();
line
.
uuid
=
uuid
;
line
.
owner
=
owner
;
line
.
ircChanName
=
iid
.
get_local
();
line
.
ircServerName
=
iid
.
get_server
();
...
...
@@ -135,6 +137,8 @@ void Database::store_muc_message(const std::string& owner, const Iid& iid,
line
.
nick
=
nick
;
line
.
update
();
return
uuid
;
}
std
::
vector
<
db
::
MucLogLine
>
Database
::
get_muc_logs
(
const
std
::
string
&
owner
,
const
std
::
string
&
chan_name
,
const
std
::
string
&
server
,
...
...
src/database/database.hpp
View file @
7f2127a7
...
...
@@ -50,7 +50,7 @@ public:
const
std
::
string
&
channel
);
static
std
::
vector
<
db
::
MucLogLine
>
get_muc_logs
(
const
std
::
string
&
owner
,
const
std
::
string
&
chan_name
,
const
std
::
string
&
server
,
int
limit
=-
1
,
const
std
::
string
&
start
=
""
,
const
std
::
string
&
end
=
""
);
static
void
store_muc_message
(
const
std
::
string
&
owner
,
const
Iid
&
iid
,
static
std
::
string
store_muc_message
(
const
std
::
string
&
owner
,
const
Iid
&
iid
,
time_point
date
,
const
std
::
string
&
body
,
const
std
::
string
&
nick
);
static
void
close
();
...
...
src/xmpp/xmpp_component.cpp
View file @
7f2127a7
...
...
@@ -380,7 +380,7 @@ void XmppComponent::send_topic(const std::string& from, Xmpp::body&& topic, cons
this
->
send_stanza
(
message
);
}
void
XmppComponent
::
send_muc_message
(
const
std
::
string
&
muc_name
,
const
std
::
string
&
nick
,
Xmpp
::
body
&&
xmpp_body
,
const
std
::
string
&
jid_to
)
void
XmppComponent
::
send_muc_message
(
const
std
::
string
&
muc_name
,
const
std
::
string
&
nick
,
Xmpp
::
body
&&
xmpp_body
,
const
std
::
string
&
jid_to
,
std
::
string
uuid
)
{
Stanza
message
(
"message"
);
message
[
"to"
]
=
jid_to
;
...
...
@@ -402,6 +402,15 @@ void XmppComponent::send_muc_message(const std::string& muc_name, const std::str
// Pass the ownership of the pointer to this xmlnode
html
.
add_child
(
std
::
move
(
std
::
get
<
1
>
(
xmpp_body
)));
}
if
(
!
uuid
.
empty
())
{
XmlSubNode
stanza_id
(
message
,
"stanza-id"
);
stanza_id
[
"xmlns"
]
=
STABLE_ID_NS
;
stanza_id
[
"by"
]
=
muc_name
+
"@"
+
this
->
served_hostname
;
stanza_id
[
"id"
]
=
std
::
move
(
uuid
);
}
this
->
send_stanza
(
message
);
}
...
...
src/xmpp/xmpp_component.hpp
View file @
7f2127a7
...
...
@@ -33,6 +33,7 @@
#define DATAFORM_NS "jabber:x:data"
#define RSM_NS "http://jabber.org/protocol/rsm"
#define MUC_TRAFFIC_NS "http://jabber.org/protocol/muc#traffic"
#define STABLE_ID_NS "urn:xmpp:sid:0"
/**
* An XMPP component, communicating with an XMPP server using the protocole
...
...
@@ -134,7 +135,8 @@ public:
/**
* Send a (non-private) message to the MUC
*/
void
send_muc_message
(
const
std
::
string
&
muc_name
,
const
std
::
string
&
nick
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
jid_to
);
void
send_muc_message
(
const
std
::
string
&
muc_name
,
const
std
::
string
&
nick
,
Xmpp
::
body
&&
body
,
const
std
::
string
&
jid_to
,
std
::
string
uuid
);
/**
* Send a message, with a <delay/> element, part of a MUC history
*/
...
...
tests/end_to_end/__main__.py
View file @
7f2127a7
...
...
@@ -132,7 +132,8 @@ def match(stanza, xpath):
'rsm'
:
'http://jabber.org/protocol/rsm'
,
'carbon'
:
'urn:xmpp:carbons:2'
,
'hints'
:
'urn:xmpp:hints'
,
'stanza'
:
'urn:ietf:params:xml:ns:xmpp-stanzas'
})
'stanza'
:
'urn:ietf:params:xml:ns:xmpp-stanzas'
,
'stable_id'
:
'urn:xmpp:sid:0'
})
return
matched
...
...
@@ -1483,7 +1484,10 @@ if __name__ == '__main__':
# Send two channel messages
partial
(
send_stanza
,
"<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou</body></message>"
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']"
),
partial
(
expect_stanza
,
(
"/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']"
,
"/message/stable_id:stanza-id[@by='#foo%{irc_server_one}'][@id]"
,)
),
partial
(
send_stanza
,
"<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou 2</body></message>"
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou 2']"
),
...
...
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