Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
promi committed Dec 2, 2016
0 parents commit 3540aa3
Show file tree
Hide file tree
Showing 101 changed files with 40,821 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
catch throw
layout src
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\#*\#
.\#*
*~
mrpbpp
aclocal.m4
config.*
missing
install-sh
depcomp
*.o
*.lo
*.la
INSTALL
.deps/
.dirstamp
Makefile
Makefile.in
configure
autom4te.cache
compile
libtool
ltmain.sh
.libs/
mrpbpp-nettest
_cert/
661 changes: 661 additions & 0 deletions COPYING

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions COPYING_ORIGINAL
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 by dafoxia, Natenom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

85 changes: 85 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
AUTOMAKE_OPTIONS = subdir-objects

lib_LTLIBRARIES = \
libaither.la \
libmumble-pluginbot-plusplus-io.la \
libmumble-pluginbot-plusplus-network.la \
libmumble-pluginbot-plusplus-openssl.la \
libmumble-pluginbot-plusplus-opus.la \
libmumble-pluginbot-plusplus-mumble.la

bin_PROGRAMS = mumble-pluginbot-plusplus

libaither_la_SOURCES = \
src/aither/log.cc \
src/aither/logger.cc \
src/aither/console-logger.cc \
src/aither/void-logger.cc

libmumble-pluginbot-plusplus_io_la_SOURCES = \
src/io/sample-reader.cc \
src/io/sample-writer.cc \
src/io/raw-s16le-file-sample-reader.cc \
src/io/raw-s16le-file-sample-writer.cc

libmumble-pluginbot-plusplus_network_la_SOURCES = \
src/network/tcp-socket.cc

libmumble-pluginbot-plusplus_openssl_la_SOURCES = \
src/openssl/basic-input-output.cc \
src/openssl/memory-basic-input-output.cc \
src/openssl/openssl.cc \
src/openssl/pem.cc \
src/openssl/pkey/envelope.cc \
src/openssl/pkey/envelope-message-digest.cc \
src/openssl/pkey/rsa.cc \
src/openssl/ssl/context.cc \
src/openssl/ssl/method.cc \
src/openssl/ssl/socket.cc \
src/openssl/x509/certificate.cc \
src/openssl/x509/extension.cc \
src/openssl/x509/extension-factory.cc \
src/openssl/x509/name.cc

libmumble-pluginbot-plusplus_opus_la_SOURCES = \
src/opus/decoder.cc \
src/opus/encoder.cc

libmumble-pluginbot-plusplus_mumble_la_SOURCES = \
src/mumble/audio-player.cc \
src/mumble/audio-recorder.cc \
src/mumble/cert-manager.cc \
src/mumble/channel.cc \
src/mumble/client.cc \
src/mumble/connection.cc \
src/mumble/img-reader.cc \
src/mumble/messages.cc \
src/mumble/mumble-2-mumble.cc \
src/mumble/packet-data-stream.cc \
src/mumble/Mumble.pb.cc \
src/mumble/udp-packet.cc \
src/mumble/user.cc

mumble-pluginbot-plusplus_SOURCES = \
src/main.cc \
src/pluginbot/main.cc \
src/pluginbot/conf.cc

AM_CPPFLAGS = \
-std=c++1z \
-Wall \
-Wextra \
-pedantic \
-I$(srcdir)/src \
$(mumble-pluginbot-plusplus_CFLAGS)

mumble-pluginbot-plusplus_LDADD = \
$(mumble-pluginbot-plusplus_LIBS) \
-lm \
libaither.la \
libmumble-pluginbot-plusplus-io.la \
libmumble-pluginbot-plusplus-network.la \
libmumble-pluginbot-plusplus-openssl.la \
libmumble-pluginbot-plusplus-opus.la \
libmumble-pluginbot-plusplus-mumble.la \
-lstdc++fs
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# mumble-pluginbot-plusplus

## Introduction

mumble-pluginbot-plusplus is an extensible [Mumble] (https://wiki.mumble.info/wiki/Main_Page) bot which can play audio, can be fed by different sources, and much more.

It is a C++ rewrite of several libraries and the original mumble-ruby-pluginbot written in Ruby:

- [opus-ruby] (https://github.com/dafoxia/opus-ruby)
- [mumble-ruby] (https://github.com/dafoxia/mumble-ruby)
- [mumble-ruby-plugin-bot] (https://github.com/dafoxia/mumble-ruby-pluginbot)

Thanks to all the original authors! See the source code for copyright information.

## Status

The rewrite is **not complete** yet.

What works:

- Command line parsing (Pass "--help" to the executable to see the syntax)
- Creating a RSA private + public key pair (PEM format)
- Creating a X.509 certificate (PEM format)
- Connection to a Mumble server
- Auto moving to a channel after connect
- Some simple chat commands such as ".help"
- FIFO reading / OPUS encoding / Streaming (in theory, can't be tested at this stage)

What doesn't work:

- Some chat commands don't work
- Plugins
- CELT support
- Portaudio support
- WAV reading / writing
- Automatic MPD startup
- Probably more ;)

## Dependencies

The code is using modern C++ language features only present in C++14 and partly C++17. It currently uses the experimental filesystem library.

- GCC 6.2+ or Clang 3.8+
- autoconf + automake
- OpenSSL
- libopus 1.1
- libprotobuf

## Building + Installing

The repository is autotools-based, you have to regenerate the configure script with commands like:

$ automake --add-missing
$ libtoolize --add-missing
$ autoreconf

Then the usual autotools process applies:

$ ./configure
$ make
$ sudo make install

## License

mumble-pluginbot-plusplus is licensed under the AGPLv3+ license. The original code is licensed under the MIT license.

## Code structure

The code consists of several libtool libraries and a binary:

- libaither - Contains a Log class with severity levels
- libmumble-pluginbot-plusplus-io - Basic File I/O
- libmumble-pluginbot-plusplus-network - TCP network socket
- libmumble-pluginbot-plusplus-openssl - Wrapper for OpenSSL (certificate + SSL/TLS)
- libmumble-pluginbot-plusplus-opus - libopus C++ wrapper
- libmumble-pluginbot-plusplus-mumble - Utility classes to talk to a Mumble server
- mumble-pluginbot-plusplus - The main binary containing the core Bot

12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
AC_INIT([mrpbpp], 1.0)
AM_INIT_AUTOMAKE([foreign])
AM_SILENT_RULES([yes])

AC_PROG_CXX
AC_PROG_LIBTOOL

PKG_CHECK_MODULES(MRPBPP, [opus >= 1.1 openssl protobuf])

AC_CONFIG_FILES([Makefile])

AC_OUTPUT
49 changes: 49 additions & 0 deletions src/aither/console-logger.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
MRPB++ - An extensible Mumble bot
Copyright (c) 2016 Phobos (promi) <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aither/console-logger.hh"

#include <cstdarg>

namespace Aither
{
struct ConsoleLogger::Impl
{
FILE *m_fp;
Impl (FILE *fp) : m_fp (fp)
{
}
};

ConsoleLogger::ConsoleLogger (FILE *fp) : pimpl (new Impl (fp))
{
}

ConsoleLogger::~ConsoleLogger ()
{
}

int ConsoleLogger::printf (const char *format, ...)
{
va_list args;
va_start (args, format);
int rc = std::vfprintf (pimpl->m_fp, format, args);
va_end (args);
return rc;
}
}
37 changes: 37 additions & 0 deletions src/aither/console-logger.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
MRPB++ - An extensible Mumble bot
Copyright (c) 2016 Phobos (promi) <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#include <cstdio>

#include "aither/logger.hh"

namespace Aither
{
class ConsoleLogger : public Logger
{
public:
ConsoleLogger (FILE* fp);
~ConsoleLogger ();
virtual int printf (const char *format, ...);
private:
struct Impl;
const std::unique_ptr<Impl> pimpl;
};
}
30 changes: 30 additions & 0 deletions src/aither/log-severity.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
MRPB++ - An extensible Mumble bot
Copyright (c) 2016 Phobos (promi) <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

namespace Aither
{
enum class LogSeverity
{
Debug,
Verbose,
Warning,
Error
};
}
Loading

0 comments on commit 3540aa3

Please sign in to comment.