equal
deleted
inserted
replaced
1 |
|
2 /* |
1 /* |
3 * marking.c -- Actions on multiple buddies |
2 * marking.c -- Actions on multiple buddies |
4 * |
3 * |
5 * Copyrigth (C) 2009 Myhailo Danylenko <isbear@ukrpost.net> |
4 * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net> |
|
5 * Copyright (C) 2012 Mikael Berthe <mikael@lilotux.net> |
6 * |
6 * |
7 * This program is free software; you can redistribute it and/or modify |
7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by |
8 * it under the terms of the GNU General Public License as published by |
9 * the Free Software Foundation; either version 2 of the License, or (at |
9 * the Free Software Foundation; either version 2 of the License, or (at |
10 * your option) any later version. |
10 * your option) any later version. |
34 #include "config.h" |
34 #include "config.h" |
35 |
35 |
36 void marking_init (void); |
36 void marking_init (void); |
37 void marking_uninit (void); |
37 void marking_uninit (void); |
38 |
38 |
39 #define DESCRIPTION ( "Actions on multiple marked buddies\nProvides commands /mark and /marked" ) |
39 #define DESCRIPTION ( "Actions on multiple marked buddies\n" \ |
|
40 "Provides commands /mark and /marked" ) |
40 |
41 |
41 module_info_t info_marking = { |
42 module_info_t info_marking = { |
42 .branch = MCABBER_BRANCH, |
43 .branch = MCABBER_BRANCH, |
43 .api = MCABBER_API_VERSION, |
44 .api = MCABBER_API_VERSION, |
44 .version = PROJECT_VERSION, |
45 .version = PROJECT_VERSION, |
205 |
206 |
206 } else if (!strcmp (cmd, "do")) { |
207 } else if (!strcmp (cmd, "do")) { |
207 char *format = args[1]; |
208 char *format = args[1]; |
208 |
209 |
209 if (!format) |
210 if (!format) |
210 scr_log_print (LPRINT_NORMAL, "You must specify action to do with marked JIDs"); |
211 scr_log_print (LPRINT_NORMAL, |
|
212 "You must specify action to do with marked JIDs"); |
211 else { |
213 else { |
212 char *pos = format; |
214 char *pos = format; |
213 gboolean found = FALSE; |
215 gboolean found = FALSE; |
214 gboolean error = FALSE; |
216 gboolean error = FALSE; |
215 |
217 |
217 if (*(pos + 1) == 's') |
219 if (*(pos + 1) == 's') |
218 found = TRUE; |
220 found = TRUE; |
219 else if (*(pos + 1) == '%') |
221 else if (*(pos + 1) == '%') |
220 ++pos; |
222 ++pos; |
221 else { |
223 else { |
222 scr_log_print (LPRINT_NORMAL, "Action string must not contain any other %%-sequesnces!"); |
224 scr_log_print (LPRINT_NORMAL, |
|
225 "Action string must not contain any other %%-sequences!"); |
223 error = TRUE; |
226 error = TRUE; |
224 break; |
227 break; |
225 } |
228 } |
226 |
229 |
227 ++pos; |
230 ++pos; |
228 } |
231 } |
229 |
232 |
230 if (!found) |
233 if (!found) |
231 scr_log_print (LPRINT_NORMAL, "Action string must contain one %%s!"); |
234 scr_log_print (LPRINT_NORMAL, |
|
235 "Action string must contain one %%s!"); |
232 else if (!error) { |
236 else if (!error) { |
233 GSList *mel; |
237 GSList *mel; |
234 |
238 |
235 for (mel = marked_jids; mel; mel = mel->next) { |
239 for (mel = marked_jids; mel; mel = mel->next) { |
236 char *jid = (char *) mel->data; |
240 char *jid = (char *) mel->data; |