summaryrefslogtreecommitdiff
path: root/plugins/NotifyAnything/SendLog/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NotifyAnything/SendLog/src')
-rw-r--r--plugins/NotifyAnything/SendLog/src/Common.h9
-rw-r--r--plugins/NotifyAnything/SendLog/src/SLImp.cpp84
-rw-r--r--plugins/NotifyAnything/SendLog/src/SendLog.cpp34
-rw-r--r--plugins/NotifyAnything/SendLog/src/SendLogWin.cpp26
-rw-r--r--plugins/NotifyAnything/SendLog/src/stdafx.cpp18
5 files changed, 0 insertions, 171 deletions
diff --git a/plugins/NotifyAnything/SendLog/src/Common.h b/plugins/NotifyAnything/SendLog/src/Common.h
deleted file mode 100644
index 6015a1c011..0000000000
--- a/plugins/NotifyAnything/SendLog/src/Common.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#define _WINSOCKAPI_ // don't include winsock 1.x
-
-#include <windows.h>
-#include <ws2tcpip.h>
-#include <string>
-#include <iostream>
-
diff --git a/plugins/NotifyAnything/SendLog/src/SLImp.cpp b/plugins/NotifyAnything/SendLog/src/SLImp.cpp
deleted file mode 100644
index 3e9b38dd77..0000000000
--- a/plugins/NotifyAnything/SendLog/src/SLImp.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "Common.h"
-
-void implementation(int argc, char **argv, bool console)
-{
- int port = 12001;
- bool tcp = false;
- const char *target = "127.0.0.1";
-
- if (argc >= 2 && !strcmp("-T", argv[1])) {
- tcp = true;
- argc -= 1;
- argv += 1;
- }
-
- if (argc >= 3 && !strcmp("-H", argv[1])) {
- target = argv[2];
- argc -= 2;
- argv += 2;
- }
-
- if (argc >= 3 && !strcmp("-P", argv[1])) {
- port = atoi(argv[2]);
- argc -= 2;
- argv += 2;
- }
-
- WSADATA wsaData;
- int err = WSAStartup(MAKEWORD(2, 2), &wsaData);
- if (err)
- throw (DWORD) err;
-
- char portbuf[10];
- sprintf(portbuf, "%i", port);
-
- ADDRINFO hints;
- memset(&hints, 0, sizeof hints);
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_family = PF_INET;
- ADDRINFO *res;
- err = getaddrinfo(target, portbuf, &hints, &res);
-
- if (err || !res)
- throw (DWORD) err;
-
- SOCKET sock;
- SOCKADDR_IN to = *(SOCKADDR_IN*)res->ai_addr;
-
- sock = socket(AF_INET, tcp ? SOCK_STREAM : SOCK_DGRAM, tcp ? IPPROTO_TCP : IPPROTO_UDP);
- if (sock == INVALID_SOCKET)
- throw (DWORD) WSAGetLastError();
-
- SOCKADDR_IN self;
- ZeroMemory(&self, sizeof self);
- self.sin_family = AF_INET;
-
- if (bind(sock, (const SOCKADDR *) &self, sizeof self))
- throw (DWORD) WSAGetLastError();
-
- if (connect(sock, (const SOCKADDR *) &to, sizeof to))
- throw (DWORD) WSAGetLastError();
-
- if (console && (argc == 1 || argc == 3 && !strcmp("-p", argv[1]))) {
- std::string prefix;
- if (argc == 3)
- prefix = argv[2];
- std::string line;
- while (std::getline(std::cin, line)) {
- std::string data = prefix + line;
- send(sock, data.data(), data.size(), 0);
- }
- } else {
- std::string message = argv[1];
- for (int i=2; i<argc; ++i) {
- message += ' ';
- message += argv[i];
- }
- send(sock, message.data(), message.size(), 0);
- }
-
- shutdown(sock, SD_BOTH);
- closesocket(sock);
-
- WSACleanup();
-}
diff --git a/plugins/NotifyAnything/SendLog/src/SendLog.cpp b/plugins/NotifyAnything/SendLog/src/SendLog.cpp
deleted file mode 100644
index de22515bfc..0000000000
--- a/plugins/NotifyAnything/SendLog/src/SendLog.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "Common.h"
-
-void implementation(int argc, char **argv, bool console);
-
-int main(int argc, char **argv)
-try
-{
- if (argc == 2 && !strcmp("/?", argv[1])) {
- std::cout << "\n"
- "Syntax: sendlog [-T] [-H host] [-P port] [-p prefix]\n"
- "\tSends each input line as a separate message, with optional prefix.\n"
- "\n"
- "Syntax: sendlog text\n"
- "\tSends single text message.\n"
- "\n"
- << std::flush;
- return 0;
- }
-
- implementation(argc, argv, true);
-}
-catch (DWORD err) {
- LPVOID lpMsgBuf;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
-
- std::cerr << (LPCTSTR)lpMsgBuf << std::endl;
- if (!std::cerr)
- MessageBox(NULL, (LPCTSTR)lpMsgBuf, "sendlog", MB_OK);
-
- LocalFree(lpMsgBuf);
-
- return 1;
-}
diff --git a/plugins/NotifyAnything/SendLog/src/SendLogWin.cpp b/plugins/NotifyAnything/SendLog/src/SendLogWin.cpp
deleted file mode 100644
index a153bc45d8..0000000000
--- a/plugins/NotifyAnything/SendLog/src/SendLogWin.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "Common.h"
-
-void implementation(int argc, char **argv, bool console);
-
-int main(int argc, char **argv)
-try
-{
- if (argc == 1 || argc == 2 && !strcmp("/?", argv[1])) {
- MessageBox(NULL, "Syntax: sendlog32 [-T] [-H host] [-P port] text\n"
- "\tSends single text message.", "Sendlog32", MB_OK);
- return 0;
- }
-
- implementation(argc, argv, false);
-}
-catch (DWORD err) {
- LPVOID lpMsgBuf;
- FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL);
-
- MessageBox(NULL, (LPCTSTR)lpMsgBuf, "sendlog32", MB_OK);
-
- LocalFree(lpMsgBuf);
-
- return 1;
-}
diff --git a/plugins/NotifyAnything/SendLog/src/stdafx.cpp b/plugins/NotifyAnything/SendLog/src/stdafx.cpp
deleted file mode 100644
index 1976d867da..0000000000
--- a/plugins/NotifyAnything/SendLog/src/stdafx.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright (C) 2012-13 Miranda NG Project (http://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-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 General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "common.h" \ No newline at end of file