Do not handle the "%" char in a special way, in the fixed_server mode
Also fix some doc
This commit is contained in:
+13
-9
@@ -63,15 +63,19 @@ The configuration file uses a simple format of the form
|
|||||||
|
|
||||||
If this option contains the hostname of an IRC server (for example
|
If this option contains the hostname of an IRC server (for example
|
||||||
irc.example.org), then biboumi will enforce the connexion to that IRC
|
irc.example.org), then biboumi will enforce the connexion to that IRC
|
||||||
server only. This means that a JID like "#chan@irc.biboumi.org" must be
|
server only. This means that a JID like "#chan@biboumi.example.com" must
|
||||||
used instead of "#chan%irc.example.org@irc.biboumi.org". In that mode,
|
be used instead of "#chan%irc.example.org@biboumi.example.com". In that
|
||||||
the virtual channel (see *Connect to an IRC server*) is not available and
|
mode, the virtual channel (see *Connect to an IRC server*) is not
|
||||||
you still need to use the ! separator to send message to an IRC user (for
|
available and you still need to use the ! separator to send message to an
|
||||||
example "foo!@biboumi.example.com" to send a message to foo), although the
|
IRC user (for example "foo!@biboumi.example.com" to send a message to
|
||||||
in-room JID still work as expected ("#channel@biboumi.example.com/Nick").
|
foo), although the in-room JID still work as expected
|
||||||
This option can for example be used by an administrator that just wants to
|
("#channel@biboumi.example.com/Nick"). On the other hand, the '%' lose
|
||||||
let their users join their own IRC server using an XMPP client, but
|
any meaning. It can appear in the JID but will not be interpreted as a
|
||||||
without letting them join any other IRC servers on the internet.
|
separator (thus the JID "#channel%hello@biboumi.example.com" points to the
|
||||||
|
channel named "#channel%hello" on the configured IRC server) This option
|
||||||
|
can for example be used by an administrator that just wants to let their
|
||||||
|
users join their own IRC server using an XMPP client, while forbidding
|
||||||
|
access to any other IRC server.
|
||||||
|
|
||||||
`log_file`
|
`log_file`
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -35,7 +35,7 @@ void Iid::init_with_fixed_server(const std::string& iid, const std::string& host
|
|||||||
{
|
{
|
||||||
this->set_server(hostname);
|
this->set_server(hostname);
|
||||||
|
|
||||||
const std::string::size_type sep = iid.find_first_of("%!");
|
const std::string::size_type sep = iid.find("!");
|
||||||
|
|
||||||
// Without any separator, we consider that it's a channel
|
// Without any separator, we consider that it's a channel
|
||||||
if (sep == std::string::npos)
|
if (sep == std::string::npos)
|
||||||
@@ -47,9 +47,6 @@ void Iid::init_with_fixed_server(const std::string& iid, const std::string& host
|
|||||||
// but the part behind it (the hostname) is ignored
|
// but the part behind it (the hostname) is ignored
|
||||||
{
|
{
|
||||||
this->set_local(iid.substr(0, sep));
|
this->set_local(iid.substr(0, sep));
|
||||||
if (iid[sep] == '%')
|
|
||||||
this->is_channel = true;
|
|
||||||
else
|
|
||||||
this->is_user = true;
|
this->is_user = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -369,13 +369,13 @@ int main()
|
|||||||
|
|
||||||
Iid iid2("#test%irc.example.org");
|
Iid iid2("#test%irc.example.org");
|
||||||
std::cout << std::to_string(iid2) << std::endl;
|
std::cout << std::to_string(iid2) << std::endl;
|
||||||
assert(std::to_string(iid2) == "#test");
|
assert(std::to_string(iid2) == "#test%irc.example.org");
|
||||||
assert(iid2.get_local() == "#test");
|
assert(iid2.get_local() == "#test%irc.example.org");
|
||||||
assert(iid2.get_server() == "fixed.example.com");
|
assert(iid2.get_server() == "fixed.example.com");
|
||||||
assert(iid2.is_channel);
|
assert(iid2.is_channel);
|
||||||
assert(!iid2.is_user);
|
assert(!iid2.is_user);
|
||||||
|
|
||||||
// Note that it is impossible to adress the XMPP server directly, or to
|
// Note that it is impossible to adress the IRC server directly, or to
|
||||||
// use the virtual channel, in that mode
|
// use the virtual channel, in that mode
|
||||||
|
|
||||||
// Iid iid3("%irc.example.org");
|
// Iid iid3("%irc.example.org");
|
||||||
@@ -391,8 +391,8 @@ int main()
|
|||||||
|
|
||||||
Iid iid6("##channel%");
|
Iid iid6("##channel%");
|
||||||
std::cout << std::to_string(iid6) << std::endl;
|
std::cout << std::to_string(iid6) << std::endl;
|
||||||
assert(std::to_string(iid6) == "##channel");
|
assert(std::to_string(iid6) == "##channel%");
|
||||||
assert(iid6.get_local() == "##channel");
|
assert(iid6.get_local() == "##channel%");
|
||||||
assert(iid6.get_server() == "fixed.example.com");
|
assert(iid6.get_server() == "fixed.example.com");
|
||||||
assert(iid6.is_channel);
|
assert(iid6.is_channel);
|
||||||
assert(!iid6.is_user);
|
assert(!iid6.is_user);
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
// #include <utils/empty_if_fixed_server.hpp>
|
|
||||||
|
|
||||||
// #include <config/config.hpp>
|
|
||||||
|
|
||||||
// namespace utils
|
|
||||||
// {
|
|
||||||
// inline std::string empty_if_fixed_server(std::string&& str)
|
|
||||||
// }
|
|
||||||
Reference in New Issue
Block a user