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
579ca4bd
Commit
579ca4bd
authored
May 07, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forward iq version results to IRC
parent
04fe15a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+9
-2
src/bridge/bridge.hpp
src/bridge/bridge.hpp
+2
-1
src/irc/irc_client.cpp
src/irc/irc_client.cpp
+2
-2
src/irc/irc_client.hpp
src/irc/irc_client.hpp
+1
-1
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+18
-0
No files found.
src/bridge/bridge.cpp
View file @
579ca4bd
...
...
@@ -170,13 +170,13 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body)
this
->
make_xmpp_body
(
body
),
this
->
user_jid
);
}
void
Bridge
::
send_private_message
(
const
Iid
&
iid
,
const
std
::
string
&
body
)
void
Bridge
::
send_private_message
(
const
Iid
&
iid
,
const
std
::
string
&
body
,
const
std
::
string
&
type
)
{
if
(
iid
.
chan
.
empty
()
||
iid
.
server
.
empty
())
return
;
IrcClient
*
irc
=
this
->
get_irc_client
(
iid
.
server
);
if
(
irc
)
irc
->
send_private_message
(
iid
.
chan
,
body
);
irc
->
send_private_message
(
iid
.
chan
,
body
,
type
);
}
void
Bridge
::
leave_irc_channel
(
Iid
&&
iid
,
std
::
string
&&
status_message
)
...
...
@@ -207,6 +207,13 @@ void Bridge::set_channel_topic(const Iid& iid, const std::string& subject)
irc
->
send_topic_command
(
iid
.
chan
,
subject
);
}
void
Bridge
::
send_xmpp_version_to_irc
(
const
Iid
&
iid
,
const
std
::
string
&
name
,
const
std
::
string
&
version
,
const
std
::
string
&
os
)
{
std
::
string
result
(
name
+
" "
+
version
+
" "
+
os
);
this
->
send_private_message
(
iid
,
"
\01
VERSION "
s
+
result
+
"
\01
"
,
"NOTICE"
);
}
void
Bridge
::
send_message
(
const
Iid
&
iid
,
const
std
::
string
&
nick
,
const
std
::
string
&
body
,
const
bool
muc
)
{
if
(
muc
)
...
...
src/bridge/bridge.hpp
View file @
579ca4bd
...
...
@@ -45,11 +45,12 @@ public:
*/
bool
join_irc_channel
(
const
Iid
&
iid
,
const
std
::
string
&
username
);
void
send_channel_message
(
const
Iid
&
iid
,
const
std
::
string
&
body
);
void
send_private_message
(
const
Iid
&
iid
,
const
std
::
string
&
body
);
void
send_private_message
(
const
Iid
&
iid
,
const
std
::
string
&
body
,
const
std
::
string
&
type
=
"PRIVMSG"
);
void
leave_irc_channel
(
Iid
&&
iid
,
std
::
string
&&
status_message
);
void
send_irc_nick_change
(
const
Iid
&
iid
,
const
std
::
string
&
new_nick
);
void
send_irc_kick
(
const
Iid
&
iid
,
const
std
::
string
&
target
,
const
std
::
string
&
reason
);
void
set_channel_topic
(
const
Iid
&
iid
,
const
std
::
string
&
subject
);
void
send_xmpp_version_to_irc
(
const
Iid
&
iid
,
const
std
::
string
&
name
,
const
std
::
string
&
version
,
const
std
::
string
&
os
);
/***
**
...
...
src/irc/irc_client.cpp
View file @
579ca4bd
...
...
@@ -192,12 +192,12 @@ bool IrcClient::send_channel_message(const std::string& chan_name, const std::st
return
true
;
}
void
IrcClient
::
send_private_message
(
const
std
::
string
&
username
,
const
std
::
string
&
body
)
void
IrcClient
::
send_private_message
(
const
std
::
string
&
username
,
const
std
::
string
&
body
,
const
std
::
string
&
type
)
{
std
::
string
::
size_type
pos
=
0
;
while
(
pos
<
body
.
size
())
{
this
->
send_message
(
IrcMessage
(
"PRIVMSG"
,
{
username
,
body
.
substr
(
pos
,
400
)}));
this
->
send_message
(
IrcMessage
(
std
::
string
(
type
)
,
{
username
,
body
.
substr
(
pos
,
400
)}));
pos
+=
400
;
}
...
...
src/irc/irc_client.hpp
View file @
579ca4bd
...
...
@@ -88,7 +88,7 @@ public:
/**
* Send a PRIVMSG command for an user
*/
void
send_private_message
(
const
std
::
string
&
username
,
const
std
::
string
&
body
);
void
send_private_message
(
const
std
::
string
&
username
,
const
std
::
string
&
body
,
const
std
::
string
&
type
);
/**
* Send the PART irc command
*/
...
...
src/xmpp/xmpp_component.cpp
View file @
579ca4bd
...
...
@@ -444,6 +444,24 @@ void XmppComponent::handle_iq(const Stanza& stanza)
else
if
(
type
==
"result"
)
{
stanza_error
.
disable
();
XmlNode
*
query
;
if
((
query
=
stanza
.
get_child
(
VERSION_NS
":query"
)))
{
XmlNode
*
name_node
=
query
->
get_child
(
VERSION_NS
":name"
);
XmlNode
*
version_node
=
query
->
get_child
(
VERSION_NS
":version"
);
XmlNode
*
os_node
=
query
->
get_child
(
VERSION_NS
":os"
);
std
::
string
name
;
std
::
string
version
;
std
::
string
os
;
if
(
name_node
)
name
=
name_node
->
get_inner
()
+
" (through the biboumi gateway)"
;
if
(
version_node
)
version
=
version_node
->
get_inner
();
if
(
os_node
)
os
=
os_node
->
get_inner
();
const
Iid
iid
(
to
.
local
);
bridge
->
send_xmpp_version_to_irc
(
iid
,
name
,
version
,
os
);
}
}
error_type
=
"cancel"
;
error_name
=
"feature-not-implemented"
;
...
...
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