Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11 andreas 1
/*
101 andreas 2
 * Copyright (C) 2020 to 2022 by Andreas Theofilu <andreas@theosys.at>
11 andreas 3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#include "tamxcommands.h"
209 andreas 20
#include "tpagemanager.h"
11 andreas 21
#include "terror.h"
22
#include "tresources.h"
14 andreas 23
#include "tconfig.h"
78 andreas 24
#include "texpat++.h"
11 andreas 25
 
83 andreas 26
#include <string>
27
#include <vector>
28
 
186 andreas 29
#if __cplusplus < 201402L
30
#   error "This module requires at least C++14 standard!"
31
#else
32
#   if __cplusplus < 201703L
33
#       include <experimental/filesystem>
34
namespace fs = std::experimental::filesystem;
35
#       warning "Support for C++14 and experimental filesystem will be removed in a future version!"
36
#   else
37
#       include <filesystem>
38
#       ifdef __ANDROID__
39
namespace fs = std::__fs::filesystem;
40
#       else
41
namespace fs = std::filesystem;
42
#       endif
43
#   endif
44
#endif
45
 
11 andreas 46
using std::string;
47
using std::vector;
78 andreas 48
using namespace Expat;
11 andreas 49
 
50
typedef struct CMD_DEFINATIONS
51
{
52
    string cmd;
53
    bool hasChannels{false};
54
    bool hasPars{false};
14 andreas 55
    char separator{0};
11 andreas 56
}CMD_DEFINATIONS;
57
 
58
CMD_DEFINATIONS cmdDefinations[] = {
14 andreas 59
    { "@WLD", false, true, ',' },
60
    { "@AFP", false, true, ',' },
127 andreas 61
    { "^AFP", false, true, ',' },
14 andreas 62
    { "@GCE", false, true, ',' },
127 andreas 63
    { "^GCE", false, true, ',' },
14 andreas 64
    { "@APG", false, true, ';' },
65
    { "@CPG", false, true, ',' },
66
    { "@DPG", false, true, ';' },
67
    { "@PDR", false, true, ';' },
68
    { "@PHE", false, true, ';' },
69
    { "@PHP", false, true, ';' },
70
    { "@PHT", false, true, ';' },
71
    { "@PPA", false, true, ',' },
104 andreas 72
    { "^PPA", false, true, ',' },
14 andreas 73
    { "@PPF", false, true, ';' },
104 andreas 74
    { "^PPF", false, true, ';' },
14 andreas 75
    { "@PPG", false, true, ';' },
104 andreas 76
    { "^PPG", false, true, ';' },
14 andreas 77
    { "@PPK", false, true, ',' },
104 andreas 78
    { "^PPK", false, true, ',' },
14 andreas 79
    { "@PPM", false, true, ';' },
104 andreas 80
    { "^PPM", false, true, ';' },
14 andreas 81
    { "@PPN", false, true, ';' },
104 andreas 82
    { "^PPN", false, true, ';' },
14 andreas 83
    { "@PPT", false, true, ';' },
104 andreas 84
    { "^PPT", false, true, ';' },
14 andreas 85
    { "@PPX", false, false, '\0' },
104 andreas 86
    { "^PPX", false, false, '\0' },
14 andreas 87
    { "@PSE", false, true, ';' },
88
    { "@PSP", false, true, ';' },
89
    { "@PST", false, true, ';' },
90
    { "PAGE", false, true, ',' },
104 andreas 91
    { "^PGE", false, true, ',' },
14 andreas 92
    { "PPOF", false, true, ';' },
93
    { "PPOG", false, true, ';' },
94
    { "PPON", false, true, ';' },
95
    { "^ANI", true, true, ',' },
96
    { "^APF", true, true, ',' },
97
    { "^BAT", true, true, ',' },
98
    { "^BAU", true, true, ',' },
99
    { "^BCB", true, true, ',' },
100
    { "?BCB", true, true, ',' },
101
    { "^BCF", true, true, ',' },
102
    { "?BCF", true, true, ',' },
103
    { "^BCT", true, true, ',' },
104
    { "?BCT", true, true, ',' },
105
    { "^BDO", true, true, ',' },
106
    { "^BFB", true, true, ',' },
107
    { "^BIM", true, true, ',' },
108
    { "^BLN", true, true, ',' },
109
    { "^BMC", true, true, ',' },
110
    { "^BMF", true, true, ',' },
111
    { "^BMI", true, true, ',' },
112
    { "^BML", true, true, ',' },
113
    { "^BMP", true, true, ',' },
114
    { "?BMP", true, true, ',' },
115
    { "^BNC", true, true, ',' },
116
    { "^BNN", true, true, ',' },
117
    { "^BNT", true, true, ',' },
118
    { "^BOP", true, true, ',' },
119
    { "?BOP", true, true, ',' },
120
    { "^BOR", true, true, ',' },
121
    { "^BOS", true, true, ',' },
122
    { "^BPP", true, true, ',' },
123
    { "^BRD", true, true, ',' },
124
    { "?BRD", true, true, ',' },
125
    { "^BSF", true, true, ',' },
126
    { "^BSP", true, true, ',' },
127
    { "^BSM", true, false, ',' },
128
    { "^BSO", true, true, ',' },
129
    { "^BVL", true, true, ',' },
130
    { "^BVN", false, true, ',' },
131
    { "^BVP", true, true, ',' },
132
    { "^BVT", true, true, ',' },
133
    { "^BWW", true, true, ',' },
134
    { "?BWW", true, true, ',' },
135
    { "^CPF", true, false, ',' },
136
    { "^DLD", false, false, ',' },
137
    { "^DPF", true, true, ',' },
138
    { "^ENA", true, true, ',' },
139
    { "^FON", true, true, ',' },
140
    { "?FON", true, true, ',' },
141
    { "^GDI", true, true, ',' },
142
    { "^GIV", true, true, ',' },
143
    { "^GLH", true, true, ',' },
144
    { "^GLL", true, true, ',' },
145
    { "^GRD", true, true, ',' },
146
    { "^GRU", true, true, ',' },
147
    { "^GSC", true, true, ',' },
148
    { "^GSN", true, true, ',' },
149
    { "^ICO", true, true, ',' },
150
    { "?ICO", true, true, ',' },
151
    { "^IRM", false, true, ',' },
152
    { "^JSB", true, true, ',' },
153
    { "?JSB", true, true, ',' },
154
    { "^JSI", true, true, ',' },
155
    { "?JSI", true, true, ',' },
156
    { "^JST", true, true, ',' },
157
    { "?JST", true, true, ',' },
158
    { "^MBT", false, false, ',' },
159
    { "^MDC", false, false, ',' },
160
    { "^SHO", true, true, ',' },
161
    { "^TEC", true, true, ',' },
162
    { "?TEC", true, true, ',' },
163
    { "^TEF", true, true, ',' },
164
    { "?TEF", true, true, ',' },
165
    { "^TOP", false, true, ',' },
166
    { "^TXT", true, true, ',' },
167
    { "?TXT", true, true, ',' },
168
    { "^UNI", true, true, ',' },
104 andreas 169
    { "^UTF", true, true, ',' },
14 andreas 170
    { "^LPC", false, true, ',' },
171
    { "^LPR", false, true, ',' },
172
    { "^LPS", false, true, ',' },
173
    { "ABEEP", false, false, ',' },
174
    { "ADBEEP", false, false, ',' },
175
    { "@AKB", false, true, ';' },
176
    { "AKEYB", false, true, ',' },
177
    { "AKEYP", false, true, ',' },
178
    { "AKEYR", false, true, ',' },
179
    { "@AKP", false, true, ';' },
180
    { "@AKR", false, false, ',' },
181
    { "BEEP", false, false, ',' },
104 andreas 182
    { "^ABP", false, false, ',' },
14 andreas 183
    { "BRIT", false, true, ',' },
184
    { "@BRT", false, true, ',' },
185
    { "DBEEP", false, false, ',' },
104 andreas 186
    { "^ADP", false, false, ',' },
14 andreas 187
    { "@EKP", false, true, ';' },
188
    { "PKEYP", false, true, ',' },
63 andreas 189
    { "@PKB", false, true, ';' },
104 andreas 190
    { "^PKB", false, true, ';' },
14 andreas 191
    { "@PKP", false, true, ';' },
104 andreas 192
    { "^PKP", false, true, ';' },
14 andreas 193
    { "SETUP", false, false, ',' },
104 andreas 194
    { "^STP", false, false, ',' },
14 andreas 195
    { "SHUTDOWN", false, false, ',' },
196
    { "SLEEP", false, false, ',' },
197
    { "@SOU", false, true, ',' },
104 andreas 198
    { "^SOU", false, true, ',' },
14 andreas 199
    { "@TKP", false, true, ';' },
104 andreas 200
    { "^TKP", false, true, ';' },
14 andreas 201
    { "TPAGEON", false, false, ',' },
202
    { "TPAGEOFF", false, false, ',' },
203
    { "@VKB", false, false, ',' },
104 andreas 204
    { "^VKB", false, false, ',' },
14 andreas 205
    { "WAKE", false, false, ',' },
206
    { "^CAL", false, false, ',' },
207
    { "^KPS", false, true, ',' },
208
    { "^VKS", false, true, ',' },
127 andreas 209
    { "^WCN?", false, true, ',' },
14 andreas 210
    { "@PWD", false, true, ',' },
211
    { "^PWD", false, true, ',' },
212
    { "^BBR", true, true, ',' },
213
    { "^RAF", false, true, ',' },
214
    { "^RFR", false, true, ',' },
215
    { "^RMF", false, true, ',' },
216
    { "^RSR", false, true, ',' },
217
    { "^MODEL?", false, false, ',' },
127 andreas 218
    { "^MOD", false, false, ',' },
219
    { "^VER?", false, false, ',' },
14 andreas 220
    { "^ICS", false, true, ',' },
221
    { "^ICE", false, false, ',' },
222
    { "^ICM", false, true, ',' },
223
    { "^PHN", false, true, ',' },
224
    { "?PHN", false, true, ',' },
233 andreas 225
    { "^LVC", false, true, ',' },
227 andreas 226
    { "^LVD", true, true, ',' },
227
    { "^LVE", true, true, ',' },
228
    { "^LVF", true, true, ',' },
233 andreas 229
    { "^LVL", true, true, ',' },
230
    { "^LVM", true, true, '|' },
231
    { "^LVN", true, true, ',' },
232
    { "^LVR", true, true, ',' },
233
    { "^LVS", true, true, ',' },
127 andreas 234
    { "GET ", false, false, ',' },
235
    { "SET ", false, false, ',' },
14 andreas 236
    { "LEVON", false, false, ',' },
237
    { "RXON", false, false, ',' },
238
    { "ON", false, true, ',' },
239
    { "OFF", false, true, ',' },
15 andreas 240
    { "LEVEL", false, true, ',' },
241
    { "BLINK", false, true, ',' },
23 andreas 242
    { "#FTR", false, true, ':' },
134 andreas 243
    { "TPCCMD", false, true, ',' },
244
    { "TPCACC", false, true, ',' },
153 andreas 245
    { "TPCSIP", false, true, ',' },
300 andreas 246
    { "^EPR", true, true, ',' },
247
    { "^SCE", true, true, ',' },
248
    { "^SDR", true, true, ',' },
249
    { "^SHD", true, true, ',' },
250
    { "^SSH", true, true, ',' },
251
    { "^STG", true, true, ',' },
14 andreas 252
    { "", false, false, '\0' }
11 andreas 253
};
254
 
255
CMD_DEFINATIONS& findCmdDefines(const string& cmd)
256
{
257
    DECL_TRACER("findCmdDefines(const string& cmd)");
258
 
259
    int i = 0;
101 andreas 260
    string uCmd = cmd;
261
    uCmd = toUpper(uCmd);
11 andreas 262
 
263
    while (cmdDefinations[i].cmd.length() > 0)
264
    {
101 andreas 265
        if (cmdDefinations[i].cmd.compare(uCmd) == 0)
11 andreas 266
            return cmdDefinations[i];
267
 
268
        i++;
269
    }
270
 
271
    return cmdDefinations[i];
272
}
273
 
274
TAmxCommands::TAmxCommands()
275
{
276
    DECL_TRACER("TAmxCommands::TAmxCommands()");
277
}
278
 
279
TAmxCommands::~TAmxCommands()
280
{
281
    DECL_TRACER("TAmxCommands::~TAmxCommands()");
194 andreas 282
 
283
    if (mMap && mSystemMap && mMap != mSystemMap)
284
    {
285
        delete mMap;
286
        delete mSystemMap;
287
    }
288
    else if (mMap)
289
        delete mMap;
290
    else if (mSystemMap)
291
        delete mSystemMap;
11 andreas 292
}
293
 
14 andreas 294
bool TAmxCommands::readMap()
295
{
296
    DECL_TRACER("TAmxCommands::readMap()");
297
 
193 andreas 298
    bool err = false;
186 andreas 299
    string projectPath = TConfig::getProjectPath();
300
 
193 andreas 301
    if (fs::exists(projectPath + "/prj.xma"))
88 andreas 302
    {
194 andreas 303
        mMap = new TMap(projectPath);
193 andreas 304
        err = mMap->haveError();
88 andreas 305
    }
14 andreas 306
 
193 andreas 307
    projectPath += "/__system";
14 andreas 308
 
193 andreas 309
    if (fs::exists(projectPath + "/prj.xma"))
14 andreas 310
    {
194 andreas 311
        mSystemMap = new TMap(projectPath);
14 andreas 312
 
193 andreas 313
        if (!err)
194 andreas 314
            err = mSystemMap->haveError();
14 andreas 315
    }
316
 
194 andreas 317
    if (!mMap)
318
        mMap = mSystemMap;
319
 
193 andreas 320
    return !err;
14 andreas 321
}
322
 
323
vector<string> TAmxCommands::getFields(string& msg, char sep)
324
{
325
    DECL_TRACER("TAmxCommands::getFields(string& msg, char sep)");
326
 
327
    vector<string> flds;
328
    bool bStr = false;
329
    string part;
330
 
16 andreas 331
    for (size_t i = 0; i < msg.length(); i++)
14 andreas 332
    {
16 andreas 333
        if (msg.at(i) == sep && !bStr)
14 andreas 334
        {
335
            flds.push_back(part);
336
            part.clear();
337
            continue;
338
        }
16 andreas 339
        else if (msg.at(i) == '\'' && !bStr)
14 andreas 340
            bStr = true;
16 andreas 341
        else if (msg.at(i) == '\'' && bStr)
14 andreas 342
            bStr = false;
343
        else
16 andreas 344
            part.append(msg.substr(i, 1));
14 andreas 345
    }
346
 
347
    if (!part.empty())
348
        flds.push_back(part);
349
 
83 andreas 350
    if (flds.size() > 0 && TStreamError::checkFilter(HLOG_DEBUG))
14 andreas 351
    {
352
        MSG_DEBUG("Found fields:");
353
        vector<string>::iterator iter;
354
        int i = 1;
355
 
118 andreas 356
        for (iter = flds.begin(); iter != flds.end(); ++iter)
14 andreas 357
        {
358
            MSG_DEBUG("    " << i << ": " << *iter);
359
            i++;
360
        }
361
    }
362
 
363
    return flds;
364
}
365
 
193 andreas 366
vector<TMap::MAP_T> TAmxCommands::findButtons(int port, vector<int>& channels, TMap::MAP_TYPE mt)
14 andreas 367
{
193 andreas 368
    DECL_TRACER("TAmxCommands::findButtons(int port, vector<int>& channels, TMap::MAP_TYPE mt)");
14 andreas 369
 
193 andreas 370
    vector<TMap::MAP_T> map;
14 andreas 371
 
209 andreas 372
    if (gPageManager && gPageManager->isSetupActive())
373
        map = mSystemMap->findButtons(port, channels, mt);
374
    else
375
        map = mMap->findButtons(port, channels, mt);
19 andreas 376
 
14 andreas 377
    return map;
378
}
379
 
165 andreas 380
string TAmxCommands::findImage(int bt, int page, int instance)
381
{
382
    DECL_TRACER("TAmxCommands::findImage(int bt, int page, int instance)");
383
 
209 andreas 384
    if (page < SYSTEM_PAGE_START)
193 andreas 385
        return mMap->findImage(bt, page, instance);
165 andreas 386
 
193 andreas 387
    return mSystemMap->findImage(bt, page, instance);
165 andreas 388
}
389
 
390
string TAmxCommands::findImage(const string& name)
391
{
392
    DECL_TRACER("TAmxCommands::findImage(const string& name)");
393
 
193 andreas 394
    string str = mMap->findImage(name);
165 andreas 395
 
193 andreas 396
    if (str.empty())
397
        return mSystemMap->findImage(name);
165 andreas 398
 
193 andreas 399
    return str;
165 andreas 400
}
401
 
193 andreas 402
vector<TMap::MAP_T> TAmxCommands::findButtonByName(const string& name)
97 andreas 403
{
404
    DECL_TRACER("TAmxCommands::findButtonByName(const string& name)");
405
 
193 andreas 406
    vector<TMap::MAP_T> map = mMap->findButtonByName(name);
97 andreas 407
 
193 andreas 408
    if (map.empty())
409
        return mSystemMap->findButtonByName(name);
97 andreas 410
 
411
    return map;
412
}
413
 
193 andreas 414
vector<TMap::MAP_T> TAmxCommands::findBargraphs(int port, vector<int>& channels)
15 andreas 415
{
416
    DECL_TRACER("TAmxCommands::findBargraphs(int port, vector<int>& channels)");
417
 
193 andreas 418
    vector<TMap::MAP_T> map = mMap->findBargraphs(port, channels);
15 andreas 419
 
193 andreas 420
    if (map.empty())
421
        return mSystemMap->findBargraphs(port, channels);
83 andreas 422
 
15 andreas 423
    return map;
424
}
425
 
107 andreas 426
vector<string> TAmxCommands::findSounds()
427
{
428
    DECL_TRACER("TAmxCommands::findSounds()");
429
 
193 andreas 430
    return mMap->findSounds();      // This is enough because there are no sounds in the system settings
107 andreas 431
}
432
 
118 andreas 433
bool TAmxCommands::soundExist(const string& sname)
107 andreas 434
{
435
    DECL_TRACER("TAmxCommands::soundExist(const string sname)");
436
 
193 andreas 437
    return mMap->soundExist(sname);
107 andreas 438
}
439
 
11 andreas 440
bool TAmxCommands::parseCommand(int device, int port, const string& cmd)
441
{
442
    DECL_TRACER("TAmxCommands::parseCommand(int device, int port, const string& cmd)");
169 andreas 443
 
11 andreas 444
    vector<CMD_TABLE>::iterator iter;
16 andreas 445
    size_t pos = cmd.find_first_of("-");
127 andreas 446
    int system = TConfig::getSystem();
447
    string scmd = getCommand(cmd);
11 andreas 448
 
127 andreas 449
    MSG_TRACE("Parsing for device <" << device << ":" << port << ":" << system << "> the command: " << scmd);
13 andreas 450
 
11 andreas 451
    if (pos != string::npos)    // Command with parameters
452
    {
453
        string rest = cmd.substr(pos + 1);
454
 
118 andreas 455
        for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 456
        {
13 andreas 457
            iter->channels.clear();
458
            iter->pars.clear();
459
 
153 andreas 460
            if (iter->cmd.compare(scmd) == 0 && iter->command)
11 andreas 461
            {
153 andreas 462
                CMD_DEFINATIONS cdef = findCmdDefines(scmd);
11 andreas 463
 
464
                if (cdef.cmd.empty())
465
                {
153 andreas 466
                    MSG_WARNING("Command \"" << scmd << "\" not found in command table! Ignoring it.");
11 andreas 467
                    continue;
468
                }
469
 
470
                if (cdef.hasChannels || cdef.hasPars)
471
                {
14 andreas 472
                    vector<string> parts = getFields(rest, cdef.separator);
11 andreas 473
 
474
                    if (cdef.hasChannels)
13 andreas 475
                        extractChannels(parts[0], &iter->channels);
11 andreas 476
 
477
                    if (cdef.hasPars)
478
                    {
13 andreas 479
                        MSG_DEBUG("Command may have parameters. Found " << parts.size() << " parameters.");
11 andreas 480
 
13 andreas 481
                        if (parts.size() > 0)
11 andreas 482
                        {
13 andreas 483
                            vector<string>::iterator piter;
484
                            int cnt = 0;
485
 
118 andreas 486
                            for (piter = parts.begin(); piter != parts.end(); ++piter)
11 andreas 487
                            {
13 andreas 488
                                if (cdef.hasChannels && !cnt)
489
                                {
490
                                    cnt++;
491
                                    continue;
492
                                }
493
 
494
                                iter->pars.push_back(*piter);
11 andreas 495
                                cnt++;
496
                            }
497
                        }
13 andreas 498
                        else
499
                            iter->pars.push_back(rest);
11 andreas 500
                    }
501
                }
502
 
503
                iter->command(port, iter->channels, iter->pars);
504
                return true;
505
            }
506
        }
507
    }
508
    else        // Command without parameter
509
    {
118 andreas 510
        for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 511
        {
153 andreas 512
            if (iter->cmd.compare(scmd) == 0 && iter->command)
11 andreas 513
            {
514
                iter->command(port, iter->channels, iter->pars);
515
                return true;
516
            }
517
        }
518
    }
519
 
520
    MSG_WARNING("Command \"" << cmd << "\" currently not supported!");
521
    return false;
522
}
523
 
524
bool TAmxCommands::extractChannels(const string& schan, vector<int>* ch)
525
{
526
    DECL_TRACER("TAmxCommands::extractChannels(const string& schan, vector<int>* ch)");
527
 
528
    if (!ch || schan.empty())
529
        return false;
530
 
16 andreas 531
    if (schan.find("&") == string::npos && schan.find(".") == string::npos)
11 andreas 532
    {
533
        int c = atoi(schan.c_str());
534
        ch->push_back(c);
535
        return true;
536
    }
537
 
538
    if (schan.find("&") != string::npos)
539
    {
540
        vector<string> parts = StrSplit(schan, "&");
541
        vector<string>::iterator iter;
542
 
83 andreas 543
        if (parts.size() > 0)
11 andreas 544
        {
118 andreas 545
            for (iter = parts.begin(); iter != parts.end(); ++iter)
11 andreas 546
            {
83 andreas 547
                if (iter->find(".") != string::npos)
548
                {
549
                    vector<string> p2 = StrSplit(*iter, ".");
11 andreas 550
 
83 andreas 551
                    if (p2.size() >= 2)
552
                    {
553
                        for (int i = atoi(p2[0].c_str()); i <= atoi(p2[1].c_str()); i++)
554
                            ch->push_back(i);
555
                    }
556
                    else if (p2.size() > 0)
557
                        ch->push_back(atoi(p2[0].c_str()));
38 andreas 558
                }
83 andreas 559
                else
560
                    ch->push_back(atoi(iter->c_str()));
11 andreas 561
            }
562
        }
563
    }
564
    else
565
    {
566
        vector<string> parts = StrSplit(schan, ".");
567
 
38 andreas 568
        if (parts.size() >= 2)
569
        {
60 andreas 570
            for (int i = atoi(parts[0].c_str()); i <= atoi(parts[1].c_str()); i++)
38 andreas 571
                ch->push_back(i);
572
        }
573
        else if (parts.size() > 0)
574
            ch->push_back(atoi(parts[0].c_str()));
11 andreas 575
    }
576
 
577
    return true;
578
}
579
 
580
void TAmxCommands::registerCommand(std::function<void (int port, vector<int>& channels, vector<string>& pars)> command, const string& name)
581
{
582
    DECL_TRACER("TAmxCommands::registerCommand(std::function<void (vector<int>& channels, vector<string>& pars)> command, const string& name)");
583
 
584
    vector<CMD_TABLE>::iterator iter;
585
 
118 andreas 586
    for (iter = mCmdTable.begin(); iter != mCmdTable.end(); ++iter)
11 andreas 587
    {
588
        if (iter->cmd.compare(name) == 0)
589
        {
590
            iter->command = command;
591
            iter->channels.clear();
592
            iter->pars.clear();
593
            return;
594
        }
595
    }
596
 
597
    CMD_TABLE ctbl;
598
    ctbl.cmd = name;
599
    ctbl.command = command;
600
    mCmdTable.push_back(ctbl);
601
}