This took WAY too long to see. The logs shouldn't be sorted while we're
still in the outer loop. Sort at the end once we've collected all the logs
we can.
/*
* slashexec - A CLI for libpurple clients
* Copyright (C) 2004-2008 Gary Kramlich
* Copyright (C) 2005-2008 Peter Lawler
* Copyright (C) 2005-2008 Daniel Atallah
* Copyright (C) 2005-2008 John Bailey
* Copyright (C) 2006-2008 Sadrul Habib Chowdhury
*
* 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; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
*/
/* XXX: Translations of strings - Several strings are NOT marked as needing to
* be translated. This is because they go only to the debug window. I only
* care to translate messages users will see in the main interface. Debug
* window messages are not important. - rekkanoryo */
/* If you can't figure out what this line is for, DON'T TOUCH IT. */
#include"../common/pp_internal.h"
#include<stdarg.h>
#include<string.h>
#ifndef _WIN32
#include<pwd.h>
#include<unistd.h>
#endif
#include<cmds.h>
#include<conversation.h>
#include<debug.h>
#include<notify.h>
#include<plugin.h>
#include<util.h>
#ifdef _WIN32
/* Windows 2000 and earlier allow only 2047 bytes in an argv vector for cmd.exe
* so we need to make sure we don't exceed that. 2036 allows "cmd.exe /c " to
* fit inside the vector. */
# define MAX_CMD_LEN 2036
#else
/* Some unixes allow only 8192 chars in an argv vector; allow some space for
* the shell command itself to fit in the vector. Besides, if anyone is
* crazy enough to use /exec for a command this long they need shot to
* begin with, or educated on the beauty of shell scripts. */
# define MAX_CMD_LEN 8000
#endif
#define PREF_PREFIX "/plugins/core/slashexec"
#define PREF_SLASH PREF_PREFIX "/slash"
#define PREF_BANG PREF_PREFIX "/bang"
staticPurpleCmdIdse_cmd;
staticgchar*shell;
staticvoid/* replace a character at the end of a string with' \0' */