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
90
Issues
90
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
369ccb03
Commit
369ccb03
authored
Jun 13, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default values for the database columns
parent
50cadf3d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+4
-2
src/database/column.hpp
src/database/column.hpp
+5
-1
src/database/database.hpp
src/database/database.hpp
+12
-6
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+1
-1
No files found.
src/bridge/bridge.cpp
View file @
369ccb03
...
...
@@ -23,12 +23,14 @@ static std::string in_encoding_for(const Bridge& bridge, const Iid& iid)
#ifdef USE_DATABASE
const
auto
jid
=
bridge
.
get_bare_jid
();
auto
options
=
Database
::
get_irc_channel_options_with_server_default
(
jid
,
iid
.
get_server
(),
iid
.
get_local
());
return
options
.
col
<
Database
::
EncodingIn
>
();
auto
result
=
options
.
col
<
Database
::
EncodingIn
>
();
if
(
!
result
.
empty
())
return
result
;
#else
(
void
)
bridge
;
(
void
)
iid
;
return
{
"ISO-8859-1"
};
#endif
return
{
"ISO-8859-1"
};
}
Bridge
::
Bridge
(
std
::
string
user_jid
,
BiboumiComponent
&
xmpp
,
std
::
shared_ptr
<
Poller
>&
poller
)
:
...
...
src/database/column.hpp
View file @
369ccb03
...
...
@@ -5,8 +5,12 @@
template
<
typename
T
>
struct
Column
{
Column
(
T
default_value
)
:
value
{
default_value
}
{}
Column
()
:
value
{}
{}
using
real_type
=
T
;
T
value
;
T
value
{}
;
};
struct
Id
:
Column
<
std
::
size_t
>
{
static
constexpr
auto
name
=
"id_"
;
...
...
src/database/database.hpp
View file @
369ccb03
...
...
@@ -49,10 +49,12 @@ class Database
static
constexpr
auto
options
=
""
;
};
struct
Ports
:
Column
<
std
::
string
>
{
static
constexpr
auto
name
=
"tlsPorts_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
Ports
()
:
Column
<
std
::
string
>
(
"6667"
)
{}};
struct
TlsPorts
:
Column
<
std
::
string
>
{
static
constexpr
auto
name
=
"ports_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
TlsPorts
()
:
Column
<
std
::
string
>
(
"6697;6670"
)
{}
};
struct
Username
:
Column
<
std
::
string
>
{
static
constexpr
auto
name
=
"username_"
;
static
constexpr
auto
options
=
""
;
};
...
...
@@ -73,16 +75,20 @@ class Database
static
constexpr
auto
options
=
""
;
};
struct
MaxHistoryLength
:
Column
<
int
>
{
static
constexpr
auto
name
=
"maxHistoryLength_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
MaxHistoryLength
()
:
Column
<
int
>
(
20
)
{}
};
struct
RecordHistory
:
Column
<
bool
>
{
static
constexpr
auto
name
=
"recordHistory_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
RecordHistory
()
:
Column
<
bool
>
(
true
)
{}};
struct
VerifyCert
:
Column
<
bool
>
{
static
constexpr
auto
name
=
"verifyCert_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
VerifyCert
()
:
Column
<
bool
>
(
true
)
{}
};
struct
Persistent
:
Column
<
bool
>
{
static
constexpr
auto
name
=
"persistent_"
;
static
constexpr
auto
options
=
""
;
};
static
constexpr
auto
options
=
""
;
Persistent
()
:
Column
<
bool
>
(
false
)
{}
};
using
MucLogLineTable
=
Table
<
Id
,
Uuid
,
Owner
,
IrcChanName
,
IrcServerName
,
Date
,
Body
,
Nick
>
;
using
MucLogLine
=
MucLogLineTable
::
RowType
;
...
...
tests/end_to_end/__main__.py
View file @
369ccb03
...
...
@@ -2417,7 +2417,7 @@ if __name__ == '__main__':
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='username']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='realname']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='encoding_in']"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='encoding_out']
/dataform:value[text()='ISO-8859-1']
"
,
"/iq/commands:command/dataform:x[@type='form']/dataform:field[@type='text-single'][@var='encoding_out']"
,
"/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