Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
louiz’
biboumi
Commits
12eeb4d1
Commit
12eeb4d1
authored
Nov 12, 2014
by
louiz’
Browse files
Implement the PING on a server or the gateway itself
fix
#2575
parent
80789c2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
12eeb4d1
Version 2.0
- Support PING requests in all directions
Version 1.1 2014-16-07
- Fix a segmentation fault when connecting to an IRC server using IPv6
...
...
src/bridge/bridge.cpp
View file @
12eeb4d1
...
...
@@ -355,6 +355,17 @@ void Bridge::send_irc_participant_ping_request(const Iid& iid, const std::string
this
->
send_irc_user_ping_request
(
iid
.
get_server
(),
nick
,
iq_id
,
to_jid
,
from_jid
);
}
void
Bridge
::
on_gateway_ping
(
const
std
::
string
&
irc_hostname
,
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
)
{
Jid
jid
(
from_jid
);
if
(
irc_hostname
.
empty
()
||
this
->
get_irc_client
(
irc_hostname
))
this
->
xmpp
->
send_iq_result
(
iq_id
,
to_jid
,
jid
.
local
);
else
this
->
xmpp
->
send_stanza_error
(
"iq"
,
to_jid
,
from_jid
,
iq_id
,
"cancel"
,
"service-unavailable"
,
""
,
true
);
}
void
Bridge
::
send_irc_version_request
(
const
std
::
string
&
irc_hostname
,
const
std
::
string
&
target
,
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
)
...
...
src/bridge/bridge.hpp
View file @
12eeb4d1
...
...
@@ -85,6 +85,12 @@ public:
void
send_irc_participant_ping_request
(
const
Iid
&
iid
,
const
std
::
string
&
nick
,
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
);
/**
* Directly send back a result if it's a gateway ping or if we are
* connected to the given IRC server, an error otherwise.
*/
void
on_gateway_ping
(
const
std
::
string
&
irc_hostname
,
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
);
/***
**
...
...
src/xmpp/xmpp_component.cpp
View file @
12eeb4d1
...
...
@@ -568,6 +568,11 @@ void XmppComponent::handle_iq(const Stanza& stanza)
bridge
->
send_irc_participant_ping_request
(
iid
,
to
.
resource
,
id
,
from
,
to_str
);
}
else
{
// Ping a channel, a server or the gateway itself
bridge
->
on_gateway_ping
(
iid
.
get_server
(),
id
,
from
,
to_str
);
}
stanza_error
.
disable
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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