marking.c
author Myhailo Danylenko <isbear@ukrpost.net>
Wed, 11 Nov 2009 11:07:19 +0200
changeset 0 aad5201e3413
child 1 c8473c43ce72
permissions -rw-r--r--
Initial commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     1
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     2
/* Copyright 2009 Myhailo Danylenko
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     3
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     4
This file is part of @PROJECT@
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     5
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     6
@PROJECT@ is free software: you can redistribute it and/or modify
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     7
it under the terms of the GNU General Public License as published by
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     8
the Free Software Foundation, either version 2 of the License, or
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
     9
(at your option) any later version.
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    10
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    11
This program is distributed in the hope that it will be useful,
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    12
but WITHOUT ANY WARRANTY; without even the implied warranty of
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    14
GNU General Public License for more details.
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    15
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    16
You should have received a copy of the GNU General Public License
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    17
along with this program.  If not, see <http://www.gnu.org/licenses/>. */
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    18
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    19
#include <glib.h>
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    20
#include <gmodule.h>
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    21
#include <string.h>
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    22
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    23
#include "hbuf.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    24
#include "screen.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    25
#include "commands.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    26
#include "compl.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    27
#include "utils.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    28
#include "logprint.h"
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    29
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    30
static GSList *marked_jids = NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    31
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    32
// mark set jid
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    33
// mark clear jid
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    34
// mark toggle jid
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    35
// marked clear
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    36
// marked do cmd
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    37
static void do_mark (char *arg)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    38
{
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    39
	char     **args   = split_arg (arg, 2, 1);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    40
	char      *cmd    = NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    41
	char      *jid    = NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    42
	gboolean   jfree  = FALSE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    43
	int        marked = -1;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    44
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    45
	if (args[0]) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    46
		cmd = args[0];
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    47
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    48
		if (args[1])
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    49
			jid = jidtodisp (args[1]);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    50
	} else
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    51
		cmd = "set";
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    52
	
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    53
	if (!strcmp (cmd, "set")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    54
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    55
		if (!g_slist_find_custom (marked_jids, jid ? jid : CURRENT_JID, (GCompareFunc) g_strcmp0)) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    56
			marked_jids = g_slist_append (marked_jids, jid ? jid : g_strdup (CURRENT_JID));
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    57
			marked = 1;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    58
		} else
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    59
			jfree = TRUE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    60
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    61
	} else if (!strcmp (cmd, "clear")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    62
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    63
		GSList *mel = g_slist_find_custom (marked_jids, jid ? jid : CURRENT_JID, (GCompareFunc) g_strcmp0);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    64
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    65
		if (mel) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    66
			g_free (mel->data);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    67
			marked_jids = g_slist_delete_link (marked_jids, mel);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    68
			marked = 0;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    69
		}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    70
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    71
		jfree = TRUE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    72
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    73
	} else if (!strcmp (cmd, "toggle")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    74
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    75
		GSList *mel = g_slist_find_custom (marked_jids, jid ? jid : CURRENT_JID, (GCompareFunc) g_strcmp0);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    76
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    77
		if (mel) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    78
			g_free (mel->data);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    79
			marked_jids = g_slist_delete_link (marked_jids, mel);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    80
			marked = 0;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    81
			jfree  = TRUE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    82
		} else {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    83
			marked_jids = g_slist_append (marked_jids, jid ? jid : g_strdup (CURRENT_JID));
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    84
			marked = 1;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    85
		}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    86
	}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    87
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    88
	if (marked == 1)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    89
		scr_WriteIncomingMessage (jid ? jid : CURRENT_JID, "Marked", 0, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    90
	else if (marked == 0)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    91
		scr_WriteIncomingMessage (jid ? jid : CURRENT_JID, "Mark cleared", 0, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    92
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    93
	if (jfree && jid)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    94
		g_free (jid);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    95
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    96
	free_arg_lst (args);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    97
}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    98
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    99
void do_marked (char *arg)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   100
{
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   101
	char **args = split_arg (arg, 2, 1);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   102
	char  *cmd = args[0];
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   103
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   104
	if (!cmd)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   105
		cmd = "list";
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   106
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   107
	if (!strcmp (cmd, "list")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   108
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   109
		GSList *mel;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   110
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   111
		scr_LogPrint (LPRINT_NORMAL, "Marked jids:");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   112
		for (mel = marked_jids; mel; mel = mel->next) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   113
			char *jid = (char *) mel->data;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   114
			scr_LogPrint (LPRINT_NORMAL, " * %s", jid);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   115
		}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   116
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   117
	} else if (!strcmp (cmd, "clear")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   118
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   119
		GSList *mel;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   120
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   121
		for (mel = marked_jids; mel; mel = mel->next)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   122
			g_free (mel->data);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   123
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   124
		g_slist_free (marked_jids);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   125
		marked_jids = NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   126
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   127
	} else if (!strcmp (cmd, "do")) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   128
		char *format = args[1];
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   129
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   130
		if (!format)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   131
			scr_LogPrint (LPRINT_NORMAL, "You must specify action to do with marked jids");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   132
		else {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   133
			char     *pos   = format;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   134
			gboolean  found = FALSE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   135
			gboolean  error = FALSE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   136
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   137
			for (pos = strchr (pos, '%'); pos; pos = strchr (pos, '%')) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   138
				if (*(pos + 1) == 's')
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   139
					found = TRUE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   140
				else if (*(pos + 1) == '%')
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   141
					++pos;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   142
				else {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   143
					scr_LogPrint (LPRINT_NORMAL, "Action string must not contain any other %%-sequesnces!");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   144
					error = TRUE;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   145
					break;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   146
				}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   147
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   148
				++pos;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   149
			}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   150
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   151
			if (!found)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   152
				scr_LogPrint (LPRINT_NORMAL, "Action string must contain one %%s!");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   153
			else if (!error) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   154
				GSList *mel;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   155
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   156
				for (mel = marked_jids; mel; mel = mel->next) {
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   157
					char *jid     = (char *) mel->data;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   158
					char *command = g_strdup_printf (format, jid);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   159
					process_command (command, TRUE);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   160
					g_free (command);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   161
				}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   162
			}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   163
		}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   164
	}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   165
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   166
	free_arg_lst (args);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   167
}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   168
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   169
gchar *g_module_check_init (GModule *module)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   170
{
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   171
	cmd_add ("mark", "", 0, COMPL_JID, do_mark, NULL);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   172
	cmd_add ("marked", "", 0, COMPL_CMD, do_marked, NULL);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   173
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   174
	return NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   175
}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   176
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   177
void g_module_unload (GModule *module)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   178
{
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   179
	cmd_del ("mark");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   180
	cmd_del ("marked");
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   181
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   182
	{
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   183
		GSList *mel;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   184
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   185
		for (mel = marked_jids; mel; mel = mel->next)
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   186
			g_free (mel->data);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   187
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   188
		g_slist_free (marked_jids);
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   189
		marked_jids = NULL;
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   190
	}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   191
}
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   192
aad5201e3413 Initial commit
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
   193
/* The End */