33 |
33 |
34 #define DESCRIPTION ( "Templated commands\nProvides command /templatecmd (and any commands, you define with it)" ) |
34 #define DESCRIPTION ( "Templated commands\nProvides command /templatecmd (and any commands, you define with it)" ) |
35 |
35 |
36 static module_info_t info_templatecmd_experimental = { |
36 static module_info_t info_templatecmd_experimental = { |
37 .branch = "experimental", |
37 .branch = "experimental", |
38 .api = 5, |
38 .api = 10, |
39 .version = PROJECT_VERSION, |
39 .version = PROJECT_VERSION, |
40 .description = DESCRIPTION, |
40 .description = DESCRIPTION, |
41 .requires = NULL, |
41 .requires = NULL, |
42 .init = tcmd_init, |
42 .init = tcmd_init, |
43 .uninit = tcmd_uninit, |
43 .uninit = tcmd_uninit, |
44 .next = NULL, |
44 .next = NULL, |
45 }; |
45 }; |
46 |
46 |
47 module_info_t info_templatecmd = { |
47 module_info_t info_templatecmd = { |
48 .branch = "dev", |
48 .branch = "dev", |
49 .api = 4, |
49 .api = 11, |
50 .version = PROJECT_VERSION, |
50 .version = PROJECT_VERSION, |
51 .description = DESCRIPTION, |
51 .description = DESCRIPTION, |
52 .requires = NULL, |
52 .requires = NULL, |
53 .init = tcmd_init, |
53 .init = tcmd_init, |
54 .uninit = tcmd_uninit, |
54 .uninit = tcmd_uninit, |
116 |
116 |
117 GSList *tel; |
117 GSList *tel; |
118 |
118 |
119 for (tel = template_commands; tel; tel = tel -> next) { |
119 for (tel = template_commands; tel; tel = tel -> next) { |
120 tcmd_t *tcmd = (tcmd_t *) tel -> data; |
120 tcmd_t *tcmd = (tcmd_t *) tel -> data; |
121 scr_LogPrint (LPRINT_NORMAL, "Templatecmd %s = %s", tcmd -> name, tcmd -> template); |
121 scr_log_print (LPRINT_NORMAL, "Templatecmd %s = %s", tcmd -> name, tcmd -> template); |
122 } |
122 } |
123 |
123 |
124 } else { |
124 } else { |
125 |
125 |
126 char *nend = strchr (arg, '='); |
126 char *nend = strchr (arg, '='); |
131 |
131 |
132 for (tel = template_commands; tel; tel = tel -> next) { |
132 for (tel = template_commands; tel; tel = tel -> next) { |
133 tcmd_t *tcmd = (tcmd_t *) tel -> data; |
133 tcmd_t *tcmd = (tcmd_t *) tel -> data; |
134 |
134 |
135 if (!strcmp (arg, tcmd -> name)) { |
135 if (!strcmp (arg, tcmd -> name)) { |
136 scr_LogPrint (LPRINT_NORMAL, "Templatecmd %s = %s", tcmd -> name, tcmd -> template); |
136 scr_log_print (LPRINT_NORMAL, "Templatecmd %s = %s", tcmd -> name, tcmd -> template); |
137 return; |
137 return; |
138 } |
138 } |
139 } |
139 } |
140 |
140 |
141 scr_LogPrint (LPRINT_NORMAL, "No template with such name."); |
141 scr_log_print (LPRINT_NORMAL, "No template with such name."); |
142 |
142 |
143 } else if (nend == arg) // error |
143 } else if (nend == arg) // error |
144 |
144 |
145 scr_LogPrint (LPRINT_NORMAL, "You must specify command name."); |
145 scr_log_print (LPRINT_NORMAL, "You must specify command name."); |
146 |
146 |
147 else { // new/modify tcmd |
147 else { // new/modify tcmd |
148 |
148 |
149 GSList *tel; |
149 GSList *tel; |
150 tcmd_t *template_command = NULL; |
150 tcmd_t *template_command = NULL; |