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
4a8bcd3c
Commit
4a8bcd3c
authored
Nov 12, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement PING to in-room participant
ref
#2575
parent
c20bdd68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+29
-1
src/bridge/bridge.hpp
src/bridge/bridge.hpp
+7
-0
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+5
-0
No files found.
src/bridge/bridge.cpp
View file @
4a8bcd3c
...
...
@@ -326,13 +326,41 @@ void Bridge::send_irc_user_ping_request(const std::string& irc_hostname, const s
this
->
add_waiting_irc
(
std
::
move
(
cb
));
}
void
Bridge
::
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
)
{
IrcClient
*
irc
=
this
->
get_irc_client
(
iid
.
get_server
());
if
(
!
irc
)
{
this
->
xmpp
->
send_stanza_error
(
"iq"
,
to_jid
,
from_jid
,
iq_id
,
"cancel"
,
"item-not-found"
,
"Not connected to IRC server"
s
+
iid
.
get_server
(),
true
);
return
;
}
IrcChannel
*
chan
=
irc
->
get_channel
(
iid
.
get_local
());
if
(
!
chan
->
joined
)
{
this
->
xmpp
->
send_stanza_error
(
"iq"
,
to_jid
,
from_jid
,
iq_id
,
"cancel"
,
"not-allowed"
,
""
,
true
);
return
;
}
if
(
chan
->
get_self
()
->
nick
!=
nick
&&
!
chan
->
find_user
(
nick
))
{
this
->
xmpp
->
send_stanza_error
(
"iq"
,
to_jid
,
from_jid
,
iq_id
,
"cancel"
,
"item-not-found"
,
"Recipient not in room"
,
true
);
return
;
}
// The user is in the room, send it a direct PING
this
->
send_irc_user_ping_request
(
iid
.
get_server
(),
nick
,
iq_id
,
to_jid
,
from_jid
);
}
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
)
{
Iid
iid
(
target
+
"!"
+
irc_hostname
);
this
->
send_private_message
(
iid
,
"
\01
VERSION
\01
"
);
// TODO, add a timer to remove that waiting iq if the server does not
// respond with a matching command before n seconds
irc_responder_callback_t
cb
=
[
this
,
target
,
iq_id
,
to_jid
,
irc_hostname
,
from_jid
](
const
std
::
string
&
hostname
,
const
IrcMessage
&
message
)
->
bool
...
...
src/bridge/bridge.hpp
View file @
4a8bcd3c
...
...
@@ -78,6 +78,13 @@ public:
void
send_irc_user_ping_request
(
const
std
::
string
&
irc_hostname
,
const
std
::
string
&
nick
,
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
);
/**
* First check if the participant is in the room, before sending a direct
* CTCP PING request to the IRC user
*/
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
);
/***
**
...
...
src/xmpp/xmpp_component.cpp
View file @
4a8bcd3c
...
...
@@ -563,6 +563,11 @@ void XmppComponent::handle_iq(const Stanza& stanza)
bridge
->
send_irc_user_ping_request
(
iid
.
get_server
(),
iid
.
get_local
(),
id
,
from
,
to_str
);
}
else
if
(
iid
.
is_channel
&&
!
to
.
resource
.
empty
())
{
// Ping a room participant (we check if the nick is in the room)
bridge
->
send_irc_participant_ping_request
(
iid
,
to
.
resource
,
id
,
from
,
to_str
);
}
stanza_error
.
disable
();
}
}
...
...
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