Project

General

Profile

Feature #951 ยป setchannel.diff

patch to implement this on the server - herrlado, 04/29/2012 10:46 PM

View differences:

handler.cpp 2012-04-05 22:20:45.000000000 +0200
string text = cHelpers::GetRecordings(args);
sock->PutLine(text);
}
else if(cmd == "DRECORDING"){
string text = cHelpers::DelRecording(args);
else if(cmd == "DRECORDING")
{
string text = cHelpers::DelRecording(args);
sock->PutLine(text);
}
else if (cmd == "SETCHANNEL")
{
string text = cHelpers::SetChannel(args);
sock->PutLine(text);
}
else if (cmd == "QUIT")
-- helpers.cpp.orig 2012-04-05 18:57:48.000000000 +0200
++ helpers.cpp 2012-04-05 22:20:10.000000000 +0200
......
return SafeCall(GetEventsIntern, Trim(args), "");
}
string cHelpers::SetChannel(string args) {
return SafeCall(SetChannelIntern, args);
}
string cHelpers::GetTimeEvents(string args) {
args = Trim(args);
......
return result + "END\r\n";
}
string cHelpers::SetChannelIntern(string args) {
if (args.size() == 0) {
return "!ERROR:SetChannel;empty args\r\n";
}
int nr = atoi(args.c_str());
string result;
ostringstream outStream;
cChannel *channel = Channels.GetByNumber(nr);
if (channel) {
if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
outStream << channel->Number();
result = "!ERROR:SetChannel;Error switching to channel " + outStream.str() + "\r\n";
return result;
} else {
return "START\r\nEND\r\n";
}
} else {
return "!ERROR:SetChannel;Unable to find channel " + args + "\r\n";
}
}
string cHelpers::GetAudioTracks(const cChannel* channel) {
string result = "";
-- helpers.h.orig 2012-04-05 18:57:53.000000000 +0200
++ helpers.h 2012-04-05 18:59:56.000000000 +0200
......
static string GetTimers(string args);
static string GetChannels(string args);
static string GetChannelEvents(string args);
static string SetChannel(string args);
static string GetTimeEvents(string args);
static string GetRecordings(string args);
static string DelRecording(string args);
......
static string GetTimersIntern();
static string GetRecordingsIntern();
static string GetChannelsIntern(string wantedChannels);
static string SetChannelIntern(string wantedChannel);
static string GetEventsIntern(string wantedChannels, string when);
static string DelRecordingIntern(string index);
static string SetTimerIntern(string args);
    (1-1/1)