summaryrefslogtreecommitdiff
path: root/server/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/connection.c')
-rw-r--r--server/connection.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/connection.c b/server/connection.c
index 56be407..0db382e 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -46,14 +46,29 @@ const cChannel* cServerConnection::ChannelFromString(const char *String, int *Ap
int temp = strtol(String, NULL, 10);
if (temp == 0)
temp = cDevice::CurrentChannel();
+#if APIVERSNUM >= 20300
+ LOCK_CHANNELS_READ;
+ if (temp >= 1 && temp <= Channels->MaxNumber())
+ channel = Channels->GetByNumber(temp);
+#else
if (temp >= 1 && temp <= Channels.MaxNumber())
channel = Channels.GetByNumber(temp);
+#endif
} else {
+#if APIVERSNUM >= 20300
+ LOCK_CHANNELS_READ;
+ channel = Channels->GetByChannelID(tChannelID::FromString(string));
+#else
channel = Channels.GetByChannelID(tChannelID::FromString(string));
+#endif
if (channel == NULL) {
int i = 1;
+#if APIVERSNUM >= 20300
+ while ((channel = Channels->GetByNumber(i, 1)) != NULL) {
+#else
while ((channel = Channels.GetByNumber(i, 1)) != NULL) {
+#endif
if (String == channel->Name())
break;