summaryrefslogtreecommitdiffstats
path: root/pyutils.c
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-08-12 22:16:53 +0000
committerChristopher Davis <loafier@gmail.com>2006-08-12 22:16:53 +0000
commit3a028090359e5d5d24ccbfc11d9b6ff5681aab4f (patch)
tree0cfb8ec1eb8a49366fc663bef00bf4dfb1f7c307 /pyutils.c
parentf13ea25509e932d426ebd69d90368fe9b1d4c1ab (diff)
downloadirssi-python-3a028090359e5d5d24ccbfc11d9b6ff5681aab4f.tar.gz
irssi-python-3a028090359e5d5d24ccbfc11d9b6ff5681aab4f.tar.xz
irssi-python-3a028090359e5d5d24ccbfc11d9b6ff5681aab4f.zip
directory structure change
git-svn-id: http://svn.irssi.org/repos/irssi-python@4312 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'pyutils.c')
-rw-r--r--pyutils.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/pyutils.c b/pyutils.c
deleted file mode 100644
index 05e1f31..0000000
--- a/pyutils.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <string.h>
-#include "pyirssi.h"
-#include "pyutils.h"
-#include "settings.h"
-#include "servers.h"
-
-/* copy paste from perl bindings */
-void py_command(const char *cmd, SERVER_REC *server, WI_ITEM_REC *item)
-{
- const char *cmdchars;
- char *sendcmd = (char *) cmd;
-
- if (*cmd == '\0')
- return;
-
- cmdchars = settings_get_str("cmdchars");
- if (strchr(cmdchars, *cmd) == NULL) {
- /* no command char - let's put it there.. */
- sendcmd = g_strdup_printf("%c%s", *cmdchars, cmd);
- }
-
- signal_emit("send command", 3, sendcmd, server, item);
- if (sendcmd != cmd) g_free(sendcmd);
-}
-
-/* return the file extension for a file, or empty string
- don't free result */
-char *file_get_ext(const char *file)
-{
- const char *dot = NULL;
-
- while (*file)
- {
- if (*file == '.')
- dot = file;
-
- file++;
- }
-
- if (dot)
- return (char *) dot + 1;
-
- return (char *) file;
-}
-
-int file_has_ext(const char *file, const char *ext)
-{
- const char *fext = file_get_ext(file);
-
- return !strcmp(fext, ext);
-}
-
-
-/* return whats in the braces -> /path/to/{filename}.py
- result must be freed */
-char *file_get_filename(const char *path)
-{
- const char *begin;
- const char *end;
- char *name;
- size_t len;
-
- begin = strrchr(path, '/');
- if (!begin)
- begin = path;
- else
- begin++;
-
- end = strrchr(begin, '.');
- if (end != NULL && end > begin)
- len = end - begin;
- else
- len = strlen(begin);
-
- name = g_strnfill(len, 0);
-
- strncpy(name, begin, len);
-
- return name;
-}
-