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
9f7782bb
Commit
9f7782bb
authored
Jul 06, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a global “persistent” option
parent
b71ca15a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
4 deletions
+33
-4
CHANGELOG.rst
CHANGELOG.rst
+1
-0
doc/biboumi.1.rst
doc/biboumi.1.rst
+4
-0
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+8
-3
src/database/database.hpp
src/database/database.hpp
+1
-1
src/xmpp/biboumi_adhoc_commands.cpp
src/xmpp/biboumi_adhoc_commands.cpp
+18
-0
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+1
-0
No files found.
CHANGELOG.rst
View file @
9f7782bb
...
...
@@ -5,6 +5,7 @@ Version 6.0
to work with the database.
- The RecordHistory option can now also be configured for each IRC channel,
individually.
- Add a global option to make all channels persistent.
Version 5.0 - 2017-05-24
========================
...
...
doc/biboumi.1.rst
View file @
9f7782bb
...
...
@@ -558,6 +558,10 @@ On the gateway itself (e.g on the JID biboumi.example.com):
the database.
* Max history length: The maximum number of lines in the history
that the server is allowed to send when joining a channel.
* Persistent: Overrides the value specified in each individual channel,
all channels are persistent, whether or not their specific value is
true or false. See below for more details on what a persistent
channel is.
On a server JID (e.g on the JID chat.freenode.org@biboumi.example.com)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
src/bridge/bridge.cpp
View file @
9f7782bb
...
...
@@ -436,9 +436,14 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
// acknowledgment from the server
bool
persistent
=
false
;
#ifdef USE_DATABASE
const
auto
coptions
=
Database
::
get_irc_channel_options_with_server_default
(
this
->
user_jid
,
iid
.
get_server
(),
iid
.
get_local
());
persistent
=
coptions
.
col
<
Database
::
Persistent
>
();
const
auto
goptions
=
Database
::
get_global_options
(
this
->
user_jid
);
if
(
goptions
.
col
<
Database
::
Persistent
>
())
persistent
=
true
;
else
{
const
auto
coptions
=
Database
::
get_irc_channel_options_with_server_default
(
this
->
user_jid
,
iid
.
get_server
(),
iid
.
get_local
());
persistent
=
coptions
.
col
<
Database
::
Persistent
>
();
}
#endif
if
(
channel
->
joined
&&
!
channel
->
parting
&&
!
persistent
)
{
...
...
src/database/database.hpp
View file @
9f7782bb
...
...
@@ -98,7 +98,7 @@ class Database
using
MucLogLineTable
=
Table
<
Id
,
Uuid
,
Owner
,
IrcChanName
,
IrcServerName
,
Date
,
Body
,
Nick
>
;
using
MucLogLine
=
MucLogLineTable
::
RowType
;
using
GlobalOptionsTable
=
Table
<
Id
,
Owner
,
MaxHistoryLength
,
RecordHistory
>
;
using
GlobalOptionsTable
=
Table
<
Id
,
Owner
,
MaxHistoryLength
,
RecordHistory
,
Persistent
>
;
using
GlobalOptions
=
GlobalOptionsTable
::
RowType
;
using
IrcServerOptionsTable
=
Table
<
Id
,
Owner
,
Server
,
Pass
,
AfterConnectionCommand
,
TlsPorts
,
Ports
,
Username
,
Realname
,
VerifyCert
,
TrustedFingerprint
,
EncodingOut
,
EncodingIn
,
MaxHistoryLength
>
;
...
...
src/xmpp/biboumi_adhoc_commands.cpp
View file @
9f7782bb
...
...
@@ -147,6 +147,21 @@ void ConfigureGlobalStep1(XmppComponent&, AdhocSession& session, XmlNode& comman
else
value
.
set_inner
(
"false"
);
}
XmlSubNode
persistent
(
x
,
"field"
);
persistent
[
"var"
]
=
"persistent"
;
persistent
[
"type"
]
=
"boolean"
;
persistent
[
"label"
]
=
"Make all channels persistent"
;
persistent
[
"desc"
]
=
"If true, all channels will be persistent"
;
{
XmlSubNode
value
(
persistent
,
"value"
);
value
.
set_name
(
"value"
);
if
(
options
.
col
<
Database
::
Persistent
>
())
value
.
set_inner
(
"true"
);
else
value
.
set_inner
(
"false"
);
}
}
void
ConfigureGlobalStep2
(
XmppComponent
&
xmpp_component
,
AdhocSession
&
session
,
XmlNode
&
command_node
)
...
...
@@ -173,6 +188,9 @@ void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session,
if
(
bridge
)
bridge
->
set_record_history
(
options
.
col
<
Database
::
RecordHistory
>
());
}
else
if
(
field
->
get_tag
(
"var"
)
==
"persistent"
&&
value
)
options
.
col
<
Database
::
Persistent
>
()
=
to_bool
(
value
->
get_inner
());
}
options
.
save
(
Database
::
db
);
...
...
tests/end_to_end/__main__.py
View file @
9f7782bb
...
...
@@ -2392,6 +2392,7 @@ if __name__ == '__main__':
"/iq/commands:command/dataform:x[@type='form']/dataform:instructions[text()='Edit the form, to configure your global settings for the component.']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='max_history_length']/dataform:value[text()='42']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='boolean'][@var='record_history']/dataform:value[text()='false']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='boolean'][@var='persistent']/dataform:value[text()='false']"
,
"/iq/commands:command/commands:actions/commands:next"
,
),
after
=
partial
(
save_value
,
"sessionid"
,
partial
(
extract_attribute
,
"/iq[@type='result']/commands:command[@node='configure']"
,
"sessionid"
))
...
...
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