mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-11 01:22:33 +02:00
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
* Deleted the 'rlm_facebook' RLM. * Deleted the 'rlm_filewrite' RLM. * Deleted the 'rlm_tagstation' RLM. * Deleted the 'rlm_twitter' RLM. * Deleted the 'rlm_udp' RLM.
This commit is contained in:
parent
f2b3b5b486
commit
22f878eaae
@ -18219,3 +18219,9 @@
|
||||
script after receiving a DELETE notification for it.
|
||||
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Removed superflous syslog() call in rdpadengined(8).
|
||||
2018-12-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Deleted the 'rlm_facebook' RLM.
|
||||
* Deleted the 'rlm_filewrite' RLM.
|
||||
* Deleted the 'rlm_tagstation' RLM.
|
||||
* Deleted the 'rlm_twitter' RLM.
|
||||
* Deleted the 'rlm_udp' RLM.
|
||||
|
@ -22,8 +22,6 @@
|
||||
AM_CFLAGS = -fPIC -Wall -I../
|
||||
|
||||
RLM_MODULES=rlm_ando.rlm\
|
||||
rlm_facebook.rlm\
|
||||
rlm_filewrite.rlm\
|
||||
rlm_icecast2.rlm\
|
||||
rlm_inno713.rlm\
|
||||
rlm_liqcomp.rlm\
|
||||
@ -33,11 +31,8 @@ RLM_MODULES=rlm_ando.rlm\
|
||||
rlm_shoutcast1.rlm\
|
||||
rlm_spinitron_plus.rlm\
|
||||
rlm_spottrap.rlm\
|
||||
rlm_tagstation.rlm\
|
||||
rlm_test.rlm\
|
||||
rlm_tunein.rlm\
|
||||
rlm_twitter.rlm\
|
||||
rlm_udp.rlm\
|
||||
rlm_urlwrite.rlm\
|
||||
rlm_walltime.rlm\
|
||||
rlm_xds.rlm\
|
||||
@ -63,8 +58,6 @@ header_HEADERS = rlm.h
|
||||
EXTRA_DIST = Makefile-example\
|
||||
rlm.h\
|
||||
rlm_ando.c\
|
||||
rlm_facebook.c\
|
||||
rlm_filewrite.c\
|
||||
rlm_icecast2.c\
|
||||
rlm_inno713.c\
|
||||
rlm_liqcomp.c\
|
||||
@ -74,11 +67,8 @@ EXTRA_DIST = Makefile-example\
|
||||
rlm_shoutcast1.c\
|
||||
rlm_spinitron_plus.c\
|
||||
rlm_spottrap.c\
|
||||
rlm_tagstation.c\
|
||||
rlm_test.c\
|
||||
rlm_tunein.c\
|
||||
rlm_twitter.c\
|
||||
rlm_udp.c\
|
||||
rlm_urlwrite.c\
|
||||
rlm_walltime.c\
|
||||
rlm_xds.c\
|
||||
|
@ -1,316 +0,0 @@
|
||||
/* rlm_facebook.c
|
||||
*
|
||||
* (C) Copyright 2008 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This is a Rivendell Loadable Module. It sends Now&Next PAD data
|
||||
* to the Facebook account(s) specified in the configuration file pointed
|
||||
* to by the plugin argument. For information about the Facebook service,
|
||||
* see http://www.facebook.com/.
|
||||
*
|
||||
* This module requires the curl(1) network transfer tool, included with
|
||||
* most Linux distros. It is also available at http://curl.haxx.se/.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_facebook.rlm rlm_facebook.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_facebook_devs;
|
||||
char *rlm_facebook_addresses;
|
||||
char *rlm_facebook_passwords;
|
||||
char *rlm_facebook_formats;
|
||||
int *rlm_facebook_masters;
|
||||
int *rlm_facebook_aux1s;
|
||||
int *rlm_facebook_aux2s;
|
||||
char *rlm_facebook_cookies;
|
||||
|
||||
|
||||
int rlm_facebook_BufferDiff(char *sString,int dOrigin,int dDiff,int dMaxSize)
|
||||
{
|
||||
int dOldSize,dNewSize;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Will it fit?
|
||||
*/
|
||||
dOldSize=strlen(sString);
|
||||
if((dOldSize+dDiff)>=dMaxSize) {
|
||||
return -1;
|
||||
}
|
||||
dNewSize=dOldSize+dDiff;
|
||||
|
||||
/*
|
||||
* Adding characters
|
||||
*/
|
||||
if(dDiff>0) {
|
||||
for(i=dOldSize;i>dOrigin;i--) {
|
||||
sString[i+dDiff]=sString[i];
|
||||
}
|
||||
return dNewSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* No Change
|
||||
*/
|
||||
if(dDiff==0) {
|
||||
return dNewSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deleting Characters
|
||||
*/
|
||||
if(dDiff<0) {
|
||||
for(i=dOrigin;i<dOldSize;i++) {
|
||||
sString[i]=sString[i-dDiff];
|
||||
}
|
||||
return dNewSize;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int rlm_facebook_EncodeString(char *sString,int dMaxSize)
|
||||
{
|
||||
int i; /* General Purpose Counter */
|
||||
char sAccum[4]; /* General String Buffer */
|
||||
|
||||
i=0;
|
||||
while(sString[i]!=0) {
|
||||
if(((sString[i]!=' ') && (sString[i]!='*') && (sString[i]!='-') &&
|
||||
(sString[i]!='_') && (sString[i]!='.')) &&
|
||||
((sString[i]<'0') ||
|
||||
((sString[i]>'9') && (sString[i]<'A')) ||
|
||||
((sString[i]>'Z') && (sString[i]<'a')) ||
|
||||
(sString[i]>'z'))) {
|
||||
if(rlm_facebook_BufferDiff(sString,i,2,dMaxSize)<0) {
|
||||
return -1;
|
||||
}
|
||||
sprintf(sAccum,"%%%2x",sString[i]);
|
||||
sString[i++]=sAccum[0];
|
||||
sString[i++]=sAccum[1];
|
||||
sString[i]=sAccum[2];
|
||||
}
|
||||
if(sString[i]==' ') {
|
||||
sString[i]='+';
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return strlen(sString);
|
||||
}
|
||||
|
||||
|
||||
void rlm_facebook_Login(int config)
|
||||
{
|
||||
char cmd[1024];
|
||||
|
||||
unlink(rlm_facebook_cookies+256*config); /* Cleanup from past session */
|
||||
snprintf(cmd,1024,
|
||||
"curl -o /dev/null -s -A Mozilla/4.0 -c %s http://www.facebook.com/",
|
||||
rlm_facebook_cookies+256*config);
|
||||
system(cmd);
|
||||
snprintf(cmd,1024,"curl -o /dev/null -s --insecure -A Mozilla/4.0 -c %s -b %s -d persistent=1 -d email=%s -d pass=%s https://login.facebook.com/login.php",
|
||||
rlm_facebook_cookies+256*config,
|
||||
rlm_facebook_cookies+256*config,
|
||||
rlm_facebook_addresses+256*config,
|
||||
rlm_facebook_passwords+256*config);
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
|
||||
void rlm_facebook_Logout(int config)
|
||||
{
|
||||
if(fork()==0) {
|
||||
execlp("curl","curl","-A","Mozilla/4.0","-b",
|
||||
rlm_facebook_cookies+256*config,
|
||||
"-o","/dev/null","-s",
|
||||
"http://www.facebook.com/logout.php",
|
||||
(char *)NULL);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int rlm_facebook_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_facebook_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char address[256];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_facebook_devs=0;
|
||||
rlm_facebook_addresses=NULL;
|
||||
rlm_facebook_passwords=NULL;
|
||||
rlm_facebook_formats=NULL;
|
||||
rlm_facebook_masters=NULL;
|
||||
rlm_facebook_aux1s=NULL;
|
||||
rlm_facebook_aux2s=NULL;
|
||||
rlm_facebook_cookies=NULL;
|
||||
|
||||
sprintf(section,"Facebook%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"EmailAddress",""),255);
|
||||
address[255]=0;
|
||||
if(strlen(address)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_facebook: no facebook accounts specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(address)>0) {
|
||||
rlm_facebook_addresses=realloc(rlm_facebook_addresses,
|
||||
(rlm_facebook_devs+1)*(rlm_facebook_devs+1)*256);
|
||||
strcpy(rlm_facebook_addresses+256*rlm_facebook_devs,address);
|
||||
rlm_facebook_EncodeString(rlm_facebook_addresses+256*rlm_facebook_devs,255);
|
||||
rlm_facebook_passwords=realloc(rlm_facebook_passwords,
|
||||
(rlm_facebook_devs+1)*(rlm_facebook_devs+1)*256);
|
||||
strcpy(rlm_facebook_passwords+256*rlm_facebook_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"Password",""));
|
||||
rlm_facebook_EncodeString(rlm_facebook_passwords+256*rlm_facebook_devs,255);
|
||||
rlm_facebook_formats=realloc(rlm_facebook_formats,(rlm_facebook_devs+1)*256);
|
||||
strncpy(rlm_facebook_formats+256*rlm_facebook_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"FormatString",""),256);
|
||||
rlm_facebook_masters=realloc(rlm_facebook_masters,
|
||||
(rlm_facebook_devs+1)*sizeof(int));
|
||||
rlm_facebook_masters[rlm_facebook_devs]=
|
||||
rlm_facebook_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
rlm_facebook_aux1s=realloc(rlm_facebook_aux1s,
|
||||
(rlm_facebook_devs+1)*sizeof(int));
|
||||
rlm_facebook_aux1s[rlm_facebook_devs]=
|
||||
rlm_facebook_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_facebook_aux2s=realloc(rlm_facebook_aux2s,
|
||||
(rlm_facebook_devs+1)*sizeof(int));
|
||||
rlm_facebook_aux2s[rlm_facebook_devs]=
|
||||
rlm_facebook_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
sprintf(errtext,"rlm_facebook: configured account \"%s\"",address);
|
||||
rlm_facebook_cookies=
|
||||
realloc(rlm_facebook_cookies,(rlm_facebook_devs+1)*256);
|
||||
snprintf(rlm_facebook_cookies+rlm_facebook_devs*256,256,
|
||||
"/tmp/rlm_facebook%d_cookies.txt",rlm_facebook_devs+1);
|
||||
rlm_facebook_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"Facebook%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"EmailAddress",""),255);
|
||||
address[255]=0;
|
||||
}
|
||||
|
||||
for(i=0;i<(rlm_facebook_devs);i++) {
|
||||
rlm_facebook_Login(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_facebook_RLMFree(void *ptr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<(rlm_facebook_devs);i++) {
|
||||
rlm_facebook_Logout(i);
|
||||
}
|
||||
free(rlm_facebook_addresses);
|
||||
free(rlm_facebook_passwords);
|
||||
free(rlm_facebook_formats);
|
||||
free(rlm_facebook_masters);
|
||||
free(rlm_facebook_aux1s);
|
||||
free(rlm_facebook_aux2s);
|
||||
free(rlm_facebook_cookies);
|
||||
}
|
||||
|
||||
|
||||
void rlm_facebook_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char str[1024];
|
||||
char pad[1024];
|
||||
char msg[1500];
|
||||
|
||||
for(i=0;i<rlm_facebook_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_facebook_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_facebook_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_facebook_aux2s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
strncpy(str,RLMResolveNowNext(ptr,now,next,
|
||||
rlm_facebook_formats+256*i),256);
|
||||
rlm_facebook_EncodeString(str,1023);
|
||||
snprintf(pad,1024,"status=%s",str);
|
||||
if(strlen(now->rlm_title)!=0) {
|
||||
if(fork()==0) {
|
||||
execlp("curl","curl","-A","Mozilla/4.0","-b",
|
||||
rlm_facebook_cookies+256*i,
|
||||
"-d",pad,
|
||||
"-d","test_name=INLINE_STATUS_EDITOR",
|
||||
"-d","action=OTHER_UPDATE",
|
||||
"-d","post_form_id=aae2d1af1c8ed0cd36ade54bc8f48427",
|
||||
"-o","/dev/null","-s",
|
||||
"http://www.facebook.com/updatestatus.php",(char *)NULL);
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_facebook: unable to execute curl(1)");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
snprintf(msg,1500,"rlm_facebook: sending pad update: \"%s\"",
|
||||
(const char *)str);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,474 +0,0 @@
|
||||
/* rlm_filewrite.c
|
||||
*
|
||||
* (C) Copyright 2012-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This is a Rivendell Loadable Module. It uses Now&Next PAD data
|
||||
* to write to one or more file(s) on the local system specified in the
|
||||
* configuration file pointed to by the plugin argument.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_filewrite.rlm rlm_filewrite.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_filewrite_devs;
|
||||
char *rlm_filewrite_filenames;
|
||||
int *rlm_filewrite_appends;
|
||||
char *rlm_filewrite_formats;
|
||||
int *rlm_filewrite_encodings;
|
||||
int *rlm_filewrite_masters;
|
||||
int *rlm_filewrite_aux1s;
|
||||
int *rlm_filewrite_aux2s;
|
||||
int *rlm_filewrite_vlog101s;
|
||||
int *rlm_filewrite_vlog102s;
|
||||
int *rlm_filewrite_vlog103s;
|
||||
int *rlm_filewrite_vlog104s;
|
||||
int *rlm_filewrite_vlog105s;
|
||||
int *rlm_filewrite_vlog106s;
|
||||
int *rlm_filewrite_vlog107s;
|
||||
int *rlm_filewrite_vlog108s;
|
||||
int *rlm_filewrite_vlog109s;
|
||||
int *rlm_filewrite_vlog110s;
|
||||
int *rlm_filewrite_vlog111s;
|
||||
int *rlm_filewrite_vlog112s;
|
||||
int *rlm_filewrite_vlog113s;
|
||||
int *rlm_filewrite_vlog114s;
|
||||
int *rlm_filewrite_vlog115s;
|
||||
int *rlm_filewrite_vlog116s;
|
||||
int *rlm_filewrite_vlog117s;
|
||||
int *rlm_filewrite_vlog118s;
|
||||
int *rlm_filewrite_vlog119s;
|
||||
int *rlm_filewrite_vlog120s;
|
||||
|
||||
void rlm_filewrite_ReplaceChar(char c,char *str,int pos)
|
||||
{
|
||||
int i;
|
||||
|
||||
str[pos]=c;
|
||||
for(i=pos+1;i<strlen(str);i++) {
|
||||
str[i]=str[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_filewrite_ProcessString(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i<(strlen(str)-1);i++) {
|
||||
if(str[i]=='\\') {
|
||||
if(str[i+1]=='r') {
|
||||
rlm_filewrite_ReplaceChar(13,str,i);
|
||||
}
|
||||
else {
|
||||
if(str[i+1]=='n') {
|
||||
rlm_filewrite_ReplaceChar(10,str,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int rlm_filewrite_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_filewrite_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char filename[256];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_filewrite_devs=0;
|
||||
rlm_filewrite_filenames=NULL;
|
||||
rlm_filewrite_appends=NULL;
|
||||
rlm_filewrite_formats=NULL;
|
||||
rlm_filewrite_encodings=NULL;
|
||||
rlm_filewrite_masters=NULL;
|
||||
rlm_filewrite_aux1s=NULL;
|
||||
rlm_filewrite_aux2s=NULL;
|
||||
rlm_filewrite_vlog101s=NULL;
|
||||
rlm_filewrite_vlog102s=NULL;
|
||||
rlm_filewrite_vlog103s=NULL;
|
||||
rlm_filewrite_vlog104s=NULL;
|
||||
rlm_filewrite_vlog105s=NULL;
|
||||
rlm_filewrite_vlog106s=NULL;
|
||||
rlm_filewrite_vlog107s=NULL;
|
||||
rlm_filewrite_vlog108s=NULL;
|
||||
rlm_filewrite_vlog109s=NULL;
|
||||
rlm_filewrite_vlog110s=NULL;
|
||||
rlm_filewrite_vlog111s=NULL;
|
||||
rlm_filewrite_vlog112s=NULL;
|
||||
rlm_filewrite_vlog113s=NULL;
|
||||
rlm_filewrite_vlog114s=NULL;
|
||||
rlm_filewrite_vlog115s=NULL;
|
||||
rlm_filewrite_vlog116s=NULL;
|
||||
rlm_filewrite_vlog117s=NULL;
|
||||
rlm_filewrite_vlog118s=NULL;
|
||||
rlm_filewrite_vlog119s=NULL;
|
||||
rlm_filewrite_vlog120s=NULL;
|
||||
|
||||
sprintf(section,"File%d",i++);
|
||||
strncpy(filename,RLMGetStringValue(ptr,arg,section,"Filename",""),255);
|
||||
filename[255]=0;
|
||||
if(strlen(filename)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_filewrite: no files specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(filename)>0) {
|
||||
rlm_filewrite_filenames=realloc(rlm_filewrite_filenames,
|
||||
(rlm_filewrite_devs+1)*(rlm_filewrite_devs+1)*256);
|
||||
strcpy(rlm_filewrite_filenames+256*rlm_filewrite_devs,filename);
|
||||
rlm_filewrite_appends=realloc(rlm_filewrite_appends,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_appends[rlm_filewrite_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"Append",0);
|
||||
rlm_filewrite_formats=realloc(rlm_filewrite_formats,(rlm_filewrite_devs+1)*8192);
|
||||
strncpy(rlm_filewrite_formats+8192*rlm_filewrite_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"FormatString",""),8192);
|
||||
rlm_filewrite_masters=realloc(rlm_filewrite_masters,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_masters[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
|
||||
rlm_filewrite_encodings=realloc(rlm_filewrite_encodings,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_encodings[rlm_filewrite_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"Encoding",RLM_ENCODE_NONE);
|
||||
rlm_filewrite_aux1s=realloc(rlm_filewrite_aux1s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_aux1s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_filewrite_aux2s=realloc(rlm_filewrite_aux2s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_aux2s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
|
||||
rlm_filewrite_vlog101s=realloc(rlm_filewrite_vlog101s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog101s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog101");
|
||||
|
||||
rlm_filewrite_vlog102s=realloc(rlm_filewrite_vlog102s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog102s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog102");
|
||||
|
||||
rlm_filewrite_vlog103s=realloc(rlm_filewrite_vlog103s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog103s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog103");
|
||||
|
||||
rlm_filewrite_vlog104s=realloc(rlm_filewrite_vlog104s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog104s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog104");
|
||||
|
||||
rlm_filewrite_vlog105s=realloc(rlm_filewrite_vlog105s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog105s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog105");
|
||||
|
||||
rlm_filewrite_vlog106s=realloc(rlm_filewrite_vlog106s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog106s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog106");
|
||||
|
||||
rlm_filewrite_vlog107s=realloc(rlm_filewrite_vlog107s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog107s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog107");
|
||||
|
||||
rlm_filewrite_vlog108s=realloc(rlm_filewrite_vlog108s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog108s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog108");
|
||||
|
||||
rlm_filewrite_vlog109s=realloc(rlm_filewrite_vlog109s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog109s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog109");
|
||||
|
||||
rlm_filewrite_vlog110s=realloc(rlm_filewrite_vlog110s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog110s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog110");
|
||||
|
||||
rlm_filewrite_vlog111s=realloc(rlm_filewrite_vlog111s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog111s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog111");
|
||||
|
||||
rlm_filewrite_vlog112s=realloc(rlm_filewrite_vlog112s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog112s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog112");
|
||||
|
||||
rlm_filewrite_vlog113s=realloc(rlm_filewrite_vlog113s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog113s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog113");
|
||||
|
||||
rlm_filewrite_vlog114s=realloc(rlm_filewrite_vlog114s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog114s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog114");
|
||||
|
||||
rlm_filewrite_vlog115s=realloc(rlm_filewrite_vlog115s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog115s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog115");
|
||||
|
||||
rlm_filewrite_vlog116s=realloc(rlm_filewrite_vlog116s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog116s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog116");
|
||||
|
||||
rlm_filewrite_vlog117s=realloc(rlm_filewrite_vlog117s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog117s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog117");
|
||||
|
||||
rlm_filewrite_vlog118s=realloc(rlm_filewrite_vlog118s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog118s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog118");
|
||||
|
||||
rlm_filewrite_vlog119s=realloc(rlm_filewrite_vlog119s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog119s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog119");
|
||||
|
||||
rlm_filewrite_vlog120s=realloc(rlm_filewrite_vlog120s,
|
||||
(rlm_filewrite_devs+1)*sizeof(int));
|
||||
rlm_filewrite_vlog120s[rlm_filewrite_devs]=
|
||||
rlm_filewrite_GetLogStatus(ptr,arg,section,"VLog120");
|
||||
|
||||
sprintf(errtext,"rlm_filewrite: configured file \"%s\"",
|
||||
rlm_filewrite_filenames+256*rlm_filewrite_devs);
|
||||
rlm_filewrite_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"File%d",i++);
|
||||
strncpy(filename,RLMGetStringValue(ptr,arg,section,"Filename",""),255);
|
||||
filename[255]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_filewrite_RLMFree(void *ptr)
|
||||
{
|
||||
free(rlm_filewrite_filenames);
|
||||
free(rlm_filewrite_appends);
|
||||
free(rlm_filewrite_formats);
|
||||
free(rlm_filewrite_encodings);
|
||||
free(rlm_filewrite_masters);
|
||||
free(rlm_filewrite_aux1s);
|
||||
free(rlm_filewrite_aux2s);
|
||||
free(rlm_filewrite_vlog101s);
|
||||
free(rlm_filewrite_vlog102s);
|
||||
free(rlm_filewrite_vlog103s);
|
||||
free(rlm_filewrite_vlog104s);
|
||||
free(rlm_filewrite_vlog105s);
|
||||
free(rlm_filewrite_vlog106s);
|
||||
free(rlm_filewrite_vlog107s);
|
||||
free(rlm_filewrite_vlog108s);
|
||||
free(rlm_filewrite_vlog109s);
|
||||
free(rlm_filewrite_vlog110s);
|
||||
free(rlm_filewrite_vlog111s);
|
||||
free(rlm_filewrite_vlog112s);
|
||||
free(rlm_filewrite_vlog113s);
|
||||
free(rlm_filewrite_vlog114s);
|
||||
free(rlm_filewrite_vlog115s);
|
||||
free(rlm_filewrite_vlog116s);
|
||||
free(rlm_filewrite_vlog117s);
|
||||
free(rlm_filewrite_vlog118s);
|
||||
free(rlm_filewrite_vlog119s);
|
||||
free(rlm_filewrite_vlog120s);
|
||||
}
|
||||
|
||||
|
||||
void rlm_filewrite_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char str[8192];
|
||||
char msg[1500];
|
||||
FILE *f;
|
||||
const char *filename;
|
||||
|
||||
for(i=0;i<rlm_filewrite_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_filewrite_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_filewrite_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_filewrite_aux2s[i];
|
||||
break;
|
||||
|
||||
case 100:
|
||||
flag=rlm_filewrite_vlog101s[i];
|
||||
break;
|
||||
|
||||
case 101:
|
||||
flag=rlm_filewrite_vlog102s[i];
|
||||
break;
|
||||
|
||||
case 102:
|
||||
flag=rlm_filewrite_vlog103s[i];
|
||||
break;
|
||||
|
||||
case 103:
|
||||
flag=rlm_filewrite_vlog104s[i];
|
||||
break;
|
||||
|
||||
case 104:
|
||||
flag=rlm_filewrite_vlog105s[i];
|
||||
break;
|
||||
|
||||
case 105:
|
||||
flag=rlm_filewrite_vlog106s[i];
|
||||
break;
|
||||
|
||||
case 106:
|
||||
flag=rlm_filewrite_vlog107s[i];
|
||||
break;
|
||||
|
||||
case 107:
|
||||
flag=rlm_filewrite_vlog108s[i];
|
||||
break;
|
||||
|
||||
case 108:
|
||||
flag=rlm_filewrite_vlog109s[i];
|
||||
break;
|
||||
|
||||
case 109:
|
||||
flag=rlm_filewrite_vlog110s[i];
|
||||
break;
|
||||
|
||||
case 110:
|
||||
flag=rlm_filewrite_vlog111s[i];
|
||||
break;
|
||||
|
||||
case 111:
|
||||
flag=rlm_filewrite_vlog112s[i];
|
||||
break;
|
||||
|
||||
case 112:
|
||||
flag=rlm_filewrite_vlog113s[i];
|
||||
break;
|
||||
|
||||
case 113:
|
||||
flag=rlm_filewrite_vlog114s[i];
|
||||
break;
|
||||
|
||||
case 114:
|
||||
flag=rlm_filewrite_vlog115s[i];
|
||||
break;
|
||||
|
||||
case 115:
|
||||
flag=rlm_filewrite_vlog116s[i];
|
||||
break;
|
||||
|
||||
case 116:
|
||||
flag=rlm_filewrite_vlog117s[i];
|
||||
break;
|
||||
|
||||
case 117:
|
||||
flag=rlm_filewrite_vlog118s[i];
|
||||
break;
|
||||
|
||||
case 118:
|
||||
flag=rlm_filewrite_vlog119s[i];
|
||||
break;
|
||||
|
||||
case 119:
|
||||
flag=rlm_filewrite_vlog120s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
strncpy(str,RLMResolveNowNextEncoded(ptr,now,next,
|
||||
rlm_filewrite_formats+8192*i,
|
||||
rlm_filewrite_encodings[i]),8192);
|
||||
rlm_filewrite_ProcessString(str);
|
||||
if ((filename=RLMDateTimeDecode(ptr,rlm_filewrite_filenames+256*i,svc->svc_name))==NULL) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_filewrite: RLMDateTimeDecode failure");
|
||||
return;
|
||||
}
|
||||
if(rlm_filewrite_appends[i]==0) {
|
||||
f=fopen(filename,"w");
|
||||
}
|
||||
else {
|
||||
f=fopen(filename,"a");
|
||||
}
|
||||
if(f!=NULL) {
|
||||
snprintf(msg,1500,"rlm_filewrite: sending pad update: \"%s\" to \"%s\"",
|
||||
str,filename);
|
||||
fprintf(f,"%s",str);
|
||||
fclose(f);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
else {
|
||||
snprintf(msg,1500,"rlm_filewrite: unable to open file \"%s\"",
|
||||
filename);
|
||||
RLMLog(ptr,LOG_WARNING,msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,511 +0,0 @@
|
||||
/* rlm_tagstation.c
|
||||
*
|
||||
* (C) Copyright 2017-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This is a sample Rivendell Loadable Module. All it does is print
|
||||
* Now & Next data to standard output for each event transition.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_tagstation.rlm rlm_tagstation.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_tagstation_devs;
|
||||
char *rlm_tagstation_clientids;
|
||||
char *rlm_tagstation_passwords;
|
||||
char *rlm_tagstation_titles;
|
||||
char *rlm_tagstation_artists;
|
||||
char *rlm_tagstation_albums;
|
||||
char *rlm_tagstation_adps;
|
||||
char *rlm_tagstation_pros;
|
||||
char *rlm_tagstation_muss;
|
||||
int *rlm_tagstation_masters;
|
||||
int *rlm_tagstation_aux1s;
|
||||
int *rlm_tagstation_aux2s;
|
||||
int *rlm_tagstation_vlog101s;
|
||||
int *rlm_tagstation_vlog102s;
|
||||
int *rlm_tagstation_vlog103s;
|
||||
int *rlm_tagstation_vlog104s;
|
||||
int *rlm_tagstation_vlog105s;
|
||||
int *rlm_tagstation_vlog106s;
|
||||
int *rlm_tagstation_vlog107s;
|
||||
int *rlm_tagstation_vlog108s;
|
||||
int *rlm_tagstation_vlog109s;
|
||||
int *rlm_tagstation_vlog110s;
|
||||
int *rlm_tagstation_vlog111s;
|
||||
int *rlm_tagstation_vlog112s;
|
||||
int *rlm_tagstation_vlog113s;
|
||||
int *rlm_tagstation_vlog114s;
|
||||
int *rlm_tagstation_vlog115s;
|
||||
int *rlm_tagstation_vlog116s;
|
||||
int *rlm_tagstation_vlog117s;
|
||||
int *rlm_tagstation_vlog118s;
|
||||
int *rlm_tagstation_vlog119s;
|
||||
int *rlm_tagstation_vlog120s;
|
||||
|
||||
int rlm_tagstation_ContainsString(const char *str,const char *substr)
|
||||
{
|
||||
int ptr=0;
|
||||
|
||||
do {
|
||||
if(strspn(str+ptr,substr)==strlen(substr)) {
|
||||
return 1;
|
||||
}
|
||||
while((str[ptr]!=',')&&(ptr<strlen(str))) {
|
||||
ptr++;
|
||||
}
|
||||
} while(++ptr<strlen(str));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *rlm_tagstation_GetCategory(const char *grp_name,int num)
|
||||
{
|
||||
static char ret[3];
|
||||
|
||||
memset(ret,0,3);
|
||||
if(strlen(grp_name)!=0) {
|
||||
if(rlm_tagstation_ContainsString(rlm_tagstation_adps+256*num,grp_name)>0) {
|
||||
strncpy(ret,"ADP",3);
|
||||
}
|
||||
if(rlm_tagstation_ContainsString(rlm_tagstation_pros+256*num,grp_name)>0) {
|
||||
strncpy(ret,"PRO",3);
|
||||
}
|
||||
if(rlm_tagstation_ContainsString(rlm_tagstation_muss+256*num,grp_name)>0) {
|
||||
strncpy(ret,"MUS",3);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int rlm_tagstation_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_tagstation_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char username[256];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_tagstation_devs=0;
|
||||
rlm_tagstation_clientids=NULL;
|
||||
rlm_tagstation_passwords=NULL;
|
||||
rlm_tagstation_titles=NULL;
|
||||
rlm_tagstation_artists=NULL;
|
||||
rlm_tagstation_albums=NULL;
|
||||
rlm_tagstation_adps=NULL;
|
||||
rlm_tagstation_pros=NULL;
|
||||
rlm_tagstation_muss=NULL;
|
||||
rlm_tagstation_masters=NULL;
|
||||
rlm_tagstation_aux1s=NULL;
|
||||
rlm_tagstation_aux2s=NULL;
|
||||
rlm_tagstation_vlog101s=NULL;
|
||||
rlm_tagstation_vlog102s=NULL;
|
||||
rlm_tagstation_vlog103s=NULL;
|
||||
rlm_tagstation_vlog104s=NULL;
|
||||
rlm_tagstation_vlog105s=NULL;
|
||||
rlm_tagstation_vlog106s=NULL;
|
||||
rlm_tagstation_vlog107s=NULL;
|
||||
rlm_tagstation_vlog108s=NULL;
|
||||
rlm_tagstation_vlog109s=NULL;
|
||||
rlm_tagstation_vlog110s=NULL;
|
||||
rlm_tagstation_vlog111s=NULL;
|
||||
rlm_tagstation_vlog112s=NULL;
|
||||
rlm_tagstation_vlog113s=NULL;
|
||||
rlm_tagstation_vlog114s=NULL;
|
||||
rlm_tagstation_vlog115s=NULL;
|
||||
rlm_tagstation_vlog116s=NULL;
|
||||
rlm_tagstation_vlog117s=NULL;
|
||||
rlm_tagstation_vlog118s=NULL;
|
||||
rlm_tagstation_vlog119s=NULL;
|
||||
rlm_tagstation_vlog120s=NULL;
|
||||
|
||||
sprintf(section,"TagStation%d",i++);
|
||||
strncpy(username,RLMGetStringValue(ptr,arg,section,"ClientId",""),255);
|
||||
username[255]=0;
|
||||
if(strlen(username)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_tagstation: no tagstation instances specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(username)>0) {
|
||||
rlm_tagstation_clientids=realloc(rlm_tagstation_clientids,
|
||||
(rlm_tagstation_devs+1)*(rlm_tagstation_devs+1)*256);
|
||||
strcpy(rlm_tagstation_clientids+256*rlm_tagstation_devs,username);
|
||||
|
||||
rlm_tagstation_passwords=realloc(rlm_tagstation_passwords,
|
||||
(rlm_tagstation_devs+1)*(rlm_tagstation_devs+1)*256);
|
||||
strcpy(rlm_tagstation_passwords+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"Password",""));
|
||||
|
||||
rlm_tagstation_titles=realloc(rlm_tagstation_titles,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_titles+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"TitleString",""),256);
|
||||
|
||||
rlm_tagstation_artists=realloc(rlm_tagstation_artists,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_artists+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"ArtistString",""),256);
|
||||
|
||||
rlm_tagstation_albums=realloc(rlm_tagstation_albums,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_albums+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"AlbumString",""),256);
|
||||
|
||||
rlm_tagstation_adps=realloc(rlm_tagstation_adps,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_adps+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"CategoryAdvertisements",""),256);
|
||||
|
||||
rlm_tagstation_pros=realloc(rlm_tagstation_pros,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_pros+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"CategoryPromotions",""),256);
|
||||
|
||||
rlm_tagstation_muss=realloc(rlm_tagstation_muss,(rlm_tagstation_devs+1)*256);
|
||||
strncpy(rlm_tagstation_muss+256*rlm_tagstation_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"CategoryMusic",""),256);
|
||||
|
||||
rlm_tagstation_masters=realloc(rlm_tagstation_masters,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_masters[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
rlm_tagstation_aux1s=realloc(rlm_tagstation_aux1s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_aux1s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_tagstation_aux2s=realloc(rlm_tagstation_aux2s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_aux2s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
|
||||
rlm_tagstation_vlog101s=realloc(rlm_tagstation_vlog101s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog101s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog101");
|
||||
|
||||
rlm_tagstation_vlog102s=realloc(rlm_tagstation_vlog102s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog102s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog102");
|
||||
|
||||
rlm_tagstation_vlog103s=realloc(rlm_tagstation_vlog103s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog103s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog103");
|
||||
|
||||
rlm_tagstation_vlog104s=realloc(rlm_tagstation_vlog104s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog104s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog104");
|
||||
|
||||
rlm_tagstation_vlog105s=realloc(rlm_tagstation_vlog105s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog105s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog105");
|
||||
|
||||
rlm_tagstation_vlog106s=realloc(rlm_tagstation_vlog106s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog106s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog106");
|
||||
|
||||
rlm_tagstation_vlog107s=realloc(rlm_tagstation_vlog107s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog107s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog107");
|
||||
|
||||
rlm_tagstation_vlog108s=realloc(rlm_tagstation_vlog108s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog108s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog108");
|
||||
|
||||
rlm_tagstation_vlog109s=realloc(rlm_tagstation_vlog109s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog109s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog109");
|
||||
|
||||
rlm_tagstation_vlog110s=realloc(rlm_tagstation_vlog110s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog110s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog110");
|
||||
|
||||
rlm_tagstation_vlog111s=realloc(rlm_tagstation_vlog111s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog111s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog111");
|
||||
|
||||
rlm_tagstation_vlog112s=realloc(rlm_tagstation_vlog112s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog112s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog112");
|
||||
|
||||
rlm_tagstation_vlog113s=realloc(rlm_tagstation_vlog113s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog113s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog113");
|
||||
|
||||
rlm_tagstation_vlog114s=realloc(rlm_tagstation_vlog114s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog114s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog114");
|
||||
|
||||
rlm_tagstation_vlog115s=realloc(rlm_tagstation_vlog115s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog115s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog115");
|
||||
|
||||
rlm_tagstation_vlog116s=realloc(rlm_tagstation_vlog116s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog116s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog116");
|
||||
|
||||
rlm_tagstation_vlog117s=realloc(rlm_tagstation_vlog117s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog117s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog117");
|
||||
|
||||
rlm_tagstation_vlog118s=realloc(rlm_tagstation_vlog118s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog118s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog118");
|
||||
|
||||
rlm_tagstation_vlog119s=realloc(rlm_tagstation_vlog119s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog119s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog119");
|
||||
|
||||
rlm_tagstation_vlog120s=realloc(rlm_tagstation_vlog120s,
|
||||
(rlm_tagstation_devs+1)*sizeof(int));
|
||||
rlm_tagstation_vlog120s[rlm_tagstation_devs]=
|
||||
rlm_tagstation_GetLogStatus(ptr,arg,section,"VLog120");
|
||||
|
||||
sprintf(errtext,
|
||||
"rlm_tagstation: configured TagStation instance for Client ID \"%s\"",
|
||||
rlm_tagstation_clientids+256*rlm_tagstation_devs);
|
||||
rlm_tagstation_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"TagStation%d",i++);
|
||||
strncpy(username,RLMGetStringValue(ptr,arg,section,"Username",""),255);
|
||||
username[255]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_tagstation_RLMFree(void *ptr)
|
||||
{
|
||||
free(rlm_tagstation_clientids);
|
||||
free(rlm_tagstation_passwords);
|
||||
free(rlm_tagstation_titles);
|
||||
free(rlm_tagstation_artists);
|
||||
free(rlm_tagstation_albums);
|
||||
free(rlm_tagstation_adps);
|
||||
free(rlm_tagstation_pros);
|
||||
free(rlm_tagstation_muss);
|
||||
free(rlm_tagstation_masters);
|
||||
free(rlm_tagstation_aux1s);
|
||||
free(rlm_tagstation_aux2s);
|
||||
free(rlm_tagstation_vlog101s);
|
||||
free(rlm_tagstation_vlog102s);
|
||||
free(rlm_tagstation_vlog103s);
|
||||
free(rlm_tagstation_vlog104s);
|
||||
free(rlm_tagstation_vlog105s);
|
||||
free(rlm_tagstation_vlog106s);
|
||||
free(rlm_tagstation_vlog107s);
|
||||
free(rlm_tagstation_vlog108s);
|
||||
free(rlm_tagstation_vlog109s);
|
||||
free(rlm_tagstation_vlog110s);
|
||||
free(rlm_tagstation_vlog111s);
|
||||
free(rlm_tagstation_vlog112s);
|
||||
free(rlm_tagstation_vlog113s);
|
||||
free(rlm_tagstation_vlog114s);
|
||||
free(rlm_tagstation_vlog115s);
|
||||
free(rlm_tagstation_vlog116s);
|
||||
free(rlm_tagstation_vlog117s);
|
||||
free(rlm_tagstation_vlog118s);
|
||||
free(rlm_tagstation_vlog119s);
|
||||
free(rlm_tagstation_vlog120s);
|
||||
}
|
||||
|
||||
|
||||
void rlm_tagstation_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char account[1024];
|
||||
char fmt[1024];
|
||||
char url[4096];
|
||||
char msg[1500];
|
||||
char category[4]={0};
|
||||
|
||||
for(i=0;i<rlm_tagstation_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_tagstation_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_tagstation_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_tagstation_aux2s[i];
|
||||
break;
|
||||
|
||||
case 100:
|
||||
flag=rlm_tagstation_vlog101s[i];
|
||||
break;
|
||||
|
||||
case 101:
|
||||
flag=rlm_tagstation_vlog102s[i];
|
||||
break;
|
||||
|
||||
case 102:
|
||||
flag=rlm_tagstation_vlog103s[i];
|
||||
break;
|
||||
|
||||
case 103:
|
||||
flag=rlm_tagstation_vlog104s[i];
|
||||
break;
|
||||
|
||||
case 104:
|
||||
flag=rlm_tagstation_vlog105s[i];
|
||||
break;
|
||||
|
||||
case 105:
|
||||
flag=rlm_tagstation_vlog106s[i];
|
||||
break;
|
||||
|
||||
case 106:
|
||||
flag=rlm_tagstation_vlog107s[i];
|
||||
break;
|
||||
|
||||
case 107:
|
||||
flag=rlm_tagstation_vlog108s[i];
|
||||
break;
|
||||
|
||||
case 108:
|
||||
flag=rlm_tagstation_vlog109s[i];
|
||||
break;
|
||||
|
||||
case 109:
|
||||
flag=rlm_tagstation_vlog110s[i];
|
||||
break;
|
||||
|
||||
case 110:
|
||||
flag=rlm_tagstation_vlog111s[i];
|
||||
break;
|
||||
|
||||
case 111:
|
||||
flag=rlm_tagstation_vlog112s[i];
|
||||
break;
|
||||
|
||||
case 112:
|
||||
flag=rlm_tagstation_vlog113s[i];
|
||||
break;
|
||||
|
||||
case 113:
|
||||
flag=rlm_tagstation_vlog114s[i];
|
||||
break;
|
||||
|
||||
case 114:
|
||||
flag=rlm_tagstation_vlog115s[i];
|
||||
break;
|
||||
|
||||
case 115:
|
||||
flag=rlm_tagstation_vlog116s[i];
|
||||
break;
|
||||
|
||||
case 116:
|
||||
flag=rlm_tagstation_vlog117s[i];
|
||||
break;
|
||||
|
||||
case 117:
|
||||
flag=rlm_tagstation_vlog118s[i];
|
||||
break;
|
||||
|
||||
case 118:
|
||||
flag=rlm_tagstation_vlog119s[i];
|
||||
break;
|
||||
|
||||
case 119:
|
||||
flag=rlm_tagstation_vlog120s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
|
||||
strncpy(category,rlm_tagstation_GetCategory(now->rlm_group,i),3);
|
||||
if(category[0]!=0) {
|
||||
snprintf(fmt,1024,"https://tsl.tagstation.com/tsl.ashx?CID=%s&Title=%s&Artist=%s&Album=%s&EventCategory=%s&EventID=%%n&Duration=%%h&LookAhead=False",
|
||||
rlm_tagstation_clientids+256*i,
|
||||
rlm_tagstation_titles+256*i,
|
||||
rlm_tagstation_artists+256*i,
|
||||
rlm_tagstation_albums+256*i,
|
||||
category);
|
||||
|
||||
strncpy(url,RLMResolveNowNextEncoded(ptr,now,next,fmt,RLM_ENCODE_URL),
|
||||
4096);
|
||||
snprintf(account,1024,"%s:%s",rlm_tagstation_clientids+256*i,
|
||||
rlm_tagstation_passwords+256*i);
|
||||
if(strlen(now->rlm_title)!=0) {
|
||||
if(fork()==0) {
|
||||
execlp("curl","curl","-u",account,"-o","/dev/null","-s",
|
||||
url,(char *)NULL);
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_tagstation: unable to execute curl(1)");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
snprintf(msg,1500,"rlm_tagstation: sending pad update: \"%s\"",
|
||||
(const char *)url);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,264 +0,0 @@
|
||||
/* rlm_twitter.c
|
||||
*
|
||||
* (C) Copyright 2008 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This is a Rivendell Loadable Module. It sends Now&Next PAD data
|
||||
* to the Twitter account(s) specified in the configuration file pointed
|
||||
* to by the plugin argument. For information about the Twitter service,
|
||||
* see http://www.twitter.com/.
|
||||
*
|
||||
* This module requires the curl(1) network transfer tool, included with
|
||||
* most Linux distros. It is also available at http://curl.haxx.se/.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_twitter.rlm rlm_twitter.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_twitter_devs;
|
||||
char *rlm_twitter_addresses;
|
||||
char *rlm_twitter_passwords;
|
||||
char *rlm_twitter_formats;
|
||||
int *rlm_twitter_masters;
|
||||
int *rlm_twitter_aux1s;
|
||||
int *rlm_twitter_aux2s;
|
||||
|
||||
|
||||
int rlm_twitter_BufferDiff(char *sString,int dOrigin,int dDiff,int dMaxSize)
|
||||
{
|
||||
int dOldSize,dNewSize;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Will it fit?
|
||||
*/
|
||||
dOldSize=strlen(sString);
|
||||
if((dOldSize+dDiff)>=dMaxSize) {
|
||||
return -1;
|
||||
}
|
||||
dNewSize=dOldSize+dDiff;
|
||||
|
||||
/*
|
||||
* Adding characters
|
||||
*/
|
||||
if(dDiff>0) {
|
||||
for(i=dOldSize;i>dOrigin;i--) {
|
||||
sString[i+dDiff]=sString[i];
|
||||
}
|
||||
return dNewSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* No Change
|
||||
*/
|
||||
if(dDiff==0) {
|
||||
return dNewSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deleting Characters
|
||||
*/
|
||||
if(dDiff<0) {
|
||||
for(i=dOrigin;i<dOldSize;i++) {
|
||||
sString[i]=sString[i-dDiff];
|
||||
}
|
||||
return dNewSize;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int rlm_twitter_EncodeString(char *sString,int dMaxSize)
|
||||
{
|
||||
int i; /* General Purpose Counter */
|
||||
char sAccum[4]; /* General String Buffer */
|
||||
|
||||
i=0;
|
||||
while(sString[i]!=0) {
|
||||
if(((sString[i]!=' ') && (sString[i]!='*') && (sString[i]!='-') &&
|
||||
(sString[i]!='_') && (sString[i]!='.')) &&
|
||||
((sString[i]<'0') ||
|
||||
((sString[i]>'9') && (sString[i]<'A')) ||
|
||||
((sString[i]>'Z') && (sString[i]<'a')) ||
|
||||
(sString[i]>'z'))) {
|
||||
if(rlm_twitter_BufferDiff(sString,i,2,dMaxSize)<0) {
|
||||
return -1;
|
||||
}
|
||||
sprintf(sAccum,"%%%2x",sString[i]);
|
||||
sString[i++]=sAccum[0];
|
||||
sString[i++]=sAccum[1];
|
||||
sString[i]=sAccum[2];
|
||||
}
|
||||
if(sString[i]==' ') {
|
||||
sString[i]='+';
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return strlen(sString);
|
||||
}
|
||||
|
||||
|
||||
int rlm_twitter_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_twitter_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char address[256];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_twitter_devs=0;
|
||||
rlm_twitter_addresses=NULL;
|
||||
rlm_twitter_passwords=NULL;
|
||||
rlm_twitter_formats=NULL;
|
||||
rlm_twitter_masters=NULL;
|
||||
rlm_twitter_aux1s=NULL;
|
||||
rlm_twitter_aux2s=NULL;
|
||||
|
||||
sprintf(section,"Twitter%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"EmailAddress",""),255);
|
||||
address[255]=0;
|
||||
if(strlen(address)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_twitter: no twitter accounts specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(address)>0) {
|
||||
rlm_twitter_addresses=realloc(rlm_twitter_addresses,
|
||||
(rlm_twitter_devs+1)*(rlm_twitter_devs+1)*256);
|
||||
strcpy(rlm_twitter_addresses+256*rlm_twitter_devs,address);
|
||||
rlm_twitter_passwords=realloc(rlm_twitter_passwords,
|
||||
(rlm_twitter_devs+1)*(rlm_twitter_devs+1)*256);
|
||||
strcpy(rlm_twitter_passwords+256*rlm_twitter_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"Password",""));
|
||||
rlm_twitter_formats=realloc(rlm_twitter_formats,(rlm_twitter_devs+1)*256);
|
||||
strncpy(rlm_twitter_formats+256*rlm_twitter_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"FormatString",""),256);
|
||||
rlm_twitter_masters=realloc(rlm_twitter_masters,
|
||||
(rlm_twitter_devs+1)*sizeof(int));
|
||||
rlm_twitter_masters[rlm_twitter_devs]=
|
||||
rlm_twitter_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
rlm_twitter_aux1s=realloc(rlm_twitter_aux1s,
|
||||
(rlm_twitter_devs+1)*sizeof(int));
|
||||
rlm_twitter_aux1s[rlm_twitter_devs]=
|
||||
rlm_twitter_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_twitter_aux2s=realloc(rlm_twitter_aux2s,
|
||||
(rlm_twitter_devs+1)*sizeof(int));
|
||||
rlm_twitter_aux2s[rlm_twitter_devs]=
|
||||
rlm_twitter_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
sprintf(errtext,"rlm_twitter: configured account \"%s\"",address);
|
||||
rlm_twitter_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"Twitter%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"EmailAddress",""),255);
|
||||
address[255]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_twitter_RLMFree(void *ptr)
|
||||
{
|
||||
free(rlm_twitter_addresses);
|
||||
free(rlm_twitter_passwords);
|
||||
free(rlm_twitter_formats);
|
||||
free(rlm_twitter_masters);
|
||||
free(rlm_twitter_aux1s);
|
||||
free(rlm_twitter_aux2s);
|
||||
}
|
||||
|
||||
|
||||
void rlm_twitter_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char str[1024];
|
||||
char account[1024];
|
||||
char pad[1024];
|
||||
char msg[1500];
|
||||
|
||||
for(i=0;i<rlm_twitter_devs;i++) {
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_twitter_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_twitter_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_twitter_aux2s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
strncpy(str,RLMResolveNowNext(ptr,now,next,
|
||||
rlm_twitter_formats+256*i),256);
|
||||
rlm_twitter_EncodeString(str,1023);
|
||||
snprintf(account,1024,"%s:%s",rlm_twitter_addresses+256*i,
|
||||
rlm_twitter_passwords+256*i);
|
||||
snprintf(pad,1024,"status=%s",str);
|
||||
if(strlen(now->rlm_title)!=0) {
|
||||
if(fork()==0) {
|
||||
execlp("curl","curl","-u",account,"-d",pad,"-o","/dev/null","-s",
|
||||
"http://twitter.com/statuses/update.xml",(char *)NULL);
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_twitter: unable to execute curl(1)");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
snprintf(msg,1500,"rlm_twitter: sending pad update: \"%s\"",
|
||||
(const char *)str);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,446 +0,0 @@
|
||||
/* rlm_udp.c
|
||||
*
|
||||
* (C) Copyright 2008-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* This is a Rivendell Loadable Module. It sends Now&Next PAD data via
|
||||
* UDP packets to the destination(s) specified in the configuration file
|
||||
* pointed to by the plugin argument.
|
||||
*
|
||||
* To compile this module, just do:
|
||||
*
|
||||
* gcc -shared -o rlm_udp.rlm rlm_udp.c
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <rlm/rlm.h>
|
||||
|
||||
int rlm_udp_devs;
|
||||
char *rlm_udp_addresses;
|
||||
uint16_t *rlm_udp_ports;
|
||||
char *rlm_udp_formats;
|
||||
int *rlm_udp_encodings;
|
||||
int *rlm_udp_null_updates;
|
||||
int *rlm_udp_masters;
|
||||
int *rlm_udp_aux1s;
|
||||
int *rlm_udp_aux2s;
|
||||
int *rlm_udp_vlog101s;
|
||||
int *rlm_udp_vlog102s;
|
||||
int *rlm_udp_vlog103s;
|
||||
int *rlm_udp_vlog104s;
|
||||
int *rlm_udp_vlog105s;
|
||||
int *rlm_udp_vlog106s;
|
||||
int *rlm_udp_vlog107s;
|
||||
int *rlm_udp_vlog108s;
|
||||
int *rlm_udp_vlog109s;
|
||||
int *rlm_udp_vlog110s;
|
||||
int *rlm_udp_vlog111s;
|
||||
int *rlm_udp_vlog112s;
|
||||
int *rlm_udp_vlog113s;
|
||||
int *rlm_udp_vlog114s;
|
||||
int *rlm_udp_vlog115s;
|
||||
int *rlm_udp_vlog116s;
|
||||
int *rlm_udp_vlog117s;
|
||||
int *rlm_udp_vlog118s;
|
||||
int *rlm_udp_vlog119s;
|
||||
int *rlm_udp_vlog120s;
|
||||
|
||||
int rlm_udp_GetLogStatus(void *ptr,const char *arg,const char *section,
|
||||
const char *logname)
|
||||
{
|
||||
const char *tag=RLMGetStringValue(ptr,arg,section,logname,"");
|
||||
if(strcasecmp(tag,"yes")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"on")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"true")==0) {
|
||||
return 1;
|
||||
}
|
||||
if(strcasecmp(tag,"no")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"off")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"false")==0) {
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(tag,"onair")==0) {
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rlm_udp_RLMStart(void *ptr,const char *arg)
|
||||
{
|
||||
char address[17];
|
||||
char section[256];
|
||||
char errtext[256];
|
||||
int i=1;
|
||||
|
||||
rlm_udp_devs=0;
|
||||
rlm_udp_addresses=NULL;
|
||||
rlm_udp_ports=NULL;
|
||||
rlm_udp_formats=NULL;
|
||||
rlm_udp_encodings=NULL;
|
||||
rlm_udp_null_updates=NULL;
|
||||
rlm_udp_masters=NULL;
|
||||
rlm_udp_aux1s=NULL;
|
||||
rlm_udp_aux2s=NULL;
|
||||
rlm_udp_vlog101s=NULL;
|
||||
rlm_udp_vlog102s=NULL;
|
||||
rlm_udp_vlog103s=NULL;
|
||||
rlm_udp_vlog104s=NULL;
|
||||
rlm_udp_vlog105s=NULL;
|
||||
rlm_udp_vlog106s=NULL;
|
||||
rlm_udp_vlog107s=NULL;
|
||||
rlm_udp_vlog108s=NULL;
|
||||
rlm_udp_vlog109s=NULL;
|
||||
rlm_udp_vlog110s=NULL;
|
||||
rlm_udp_vlog111s=NULL;
|
||||
rlm_udp_vlog112s=NULL;
|
||||
rlm_udp_vlog113s=NULL;
|
||||
rlm_udp_vlog114s=NULL;
|
||||
rlm_udp_vlog115s=NULL;
|
||||
rlm_udp_vlog116s=NULL;
|
||||
rlm_udp_vlog117s=NULL;
|
||||
rlm_udp_vlog118s=NULL;
|
||||
rlm_udp_vlog119s=NULL;
|
||||
rlm_udp_vlog120s=NULL;
|
||||
|
||||
sprintf(section,"Udp%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
|
||||
if(strlen(address)==0) {
|
||||
RLMLog(ptr,LOG_WARNING,"rlm_udp: no udp destinations specified");
|
||||
return;
|
||||
}
|
||||
while(strlen(address)>0) {
|
||||
rlm_udp_addresses=
|
||||
realloc(rlm_udp_addresses,(rlm_udp_devs+1)*(rlm_udp_devs+1)*16);
|
||||
strcpy(rlm_udp_addresses+16*rlm_udp_devs,address);
|
||||
rlm_udp_ports=realloc(rlm_udp_ports,(rlm_udp_devs+1)*sizeof(uint16_t));
|
||||
rlm_udp_ports[rlm_udp_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"UdpPort",0);
|
||||
rlm_udp_formats=realloc(rlm_udp_formats,(rlm_udp_devs+1)*256);
|
||||
strncpy(rlm_udp_formats+256*rlm_udp_devs,
|
||||
RLMGetStringValue(ptr,arg,section,"FormatString",""),256);
|
||||
rlm_udp_encodings=realloc(rlm_udp_encodings,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_encodings[rlm_udp_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"Encoding",RLM_ENCODE_NONE);
|
||||
rlm_udp_null_updates=realloc(rlm_udp_null_updates,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_null_updates[rlm_udp_devs]=
|
||||
RLMGetIntegerValue(ptr,arg,section,"ProcessNullUpdates",0);
|
||||
rlm_udp_masters=realloc(rlm_udp_masters,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_masters[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"MasterLog");
|
||||
|
||||
rlm_udp_aux1s=realloc(rlm_udp_aux1s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_aux1s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"Aux1Log");
|
||||
rlm_udp_aux2s=realloc(rlm_udp_aux2s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_aux2s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"Aux2Log");
|
||||
|
||||
rlm_udp_vlog101s=realloc(rlm_udp_vlog101s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog101s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog101");
|
||||
|
||||
rlm_udp_vlog102s=realloc(rlm_udp_vlog102s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog102s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog102");
|
||||
|
||||
rlm_udp_vlog103s=realloc(rlm_udp_vlog103s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog103s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog103");
|
||||
|
||||
rlm_udp_vlog104s=realloc(rlm_udp_vlog104s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog104s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog104");
|
||||
|
||||
rlm_udp_vlog105s=realloc(rlm_udp_vlog105s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog105s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog105");
|
||||
|
||||
rlm_udp_vlog106s=realloc(rlm_udp_vlog106s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog106s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog106");
|
||||
|
||||
rlm_udp_vlog107s=realloc(rlm_udp_vlog107s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog107s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog107");
|
||||
|
||||
rlm_udp_vlog108s=realloc(rlm_udp_vlog108s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog108s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog108");
|
||||
|
||||
rlm_udp_vlog109s=realloc(rlm_udp_vlog109s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog109s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog109");
|
||||
|
||||
rlm_udp_vlog110s=realloc(rlm_udp_vlog110s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog110s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog110");
|
||||
|
||||
rlm_udp_vlog111s=realloc(rlm_udp_vlog111s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog111s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog111");
|
||||
|
||||
rlm_udp_vlog112s=realloc(rlm_udp_vlog112s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog112s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog112");
|
||||
|
||||
rlm_udp_vlog113s=realloc(rlm_udp_vlog113s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog113s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog113");
|
||||
|
||||
rlm_udp_vlog114s=realloc(rlm_udp_vlog114s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog114s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog114");
|
||||
|
||||
rlm_udp_vlog115s=realloc(rlm_udp_vlog115s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog115s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog115");
|
||||
|
||||
rlm_udp_vlog116s=realloc(rlm_udp_vlog116s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog116s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog116");
|
||||
|
||||
rlm_udp_vlog117s=realloc(rlm_udp_vlog117s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog117s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog117");
|
||||
|
||||
rlm_udp_vlog118s=realloc(rlm_udp_vlog118s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog118s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog118");
|
||||
|
||||
rlm_udp_vlog119s=realloc(rlm_udp_vlog119s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog119s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog119");
|
||||
|
||||
rlm_udp_vlog120s=realloc(rlm_udp_vlog120s,
|
||||
(rlm_udp_devs+1)*sizeof(int));
|
||||
rlm_udp_vlog120s[rlm_udp_devs]=
|
||||
rlm_udp_GetLogStatus(ptr,arg,section,"VLog120");
|
||||
|
||||
sprintf(errtext,"rlm_udp: configured destination \"%s:%d\"",address,
|
||||
rlm_udp_ports[rlm_udp_devs]);
|
||||
rlm_udp_devs++;
|
||||
RLMLog(ptr,LOG_INFO,errtext);
|
||||
sprintf(section,"Udp%d",i++);
|
||||
strncpy(address,RLMGetStringValue(ptr,arg,section,"IpAddress",""),15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rlm_udp_RLMFree(void *ptr)
|
||||
{
|
||||
free(rlm_udp_addresses);
|
||||
free(rlm_udp_ports);
|
||||
free(rlm_udp_formats);
|
||||
free(rlm_udp_encodings);
|
||||
free(rlm_udp_null_updates);
|
||||
free(rlm_udp_masters);
|
||||
free(rlm_udp_aux1s);
|
||||
free(rlm_udp_aux2s);
|
||||
free(rlm_udp_vlog101s);
|
||||
free(rlm_udp_vlog102s);
|
||||
free(rlm_udp_vlog103s);
|
||||
free(rlm_udp_vlog104s);
|
||||
free(rlm_udp_vlog105s);
|
||||
free(rlm_udp_vlog106s);
|
||||
free(rlm_udp_vlog107s);
|
||||
free(rlm_udp_vlog108s);
|
||||
free(rlm_udp_vlog109s);
|
||||
free(rlm_udp_vlog110s);
|
||||
free(rlm_udp_vlog111s);
|
||||
free(rlm_udp_vlog112s);
|
||||
free(rlm_udp_vlog113s);
|
||||
free(rlm_udp_vlog114s);
|
||||
free(rlm_udp_vlog115s);
|
||||
free(rlm_udp_vlog116s);
|
||||
free(rlm_udp_vlog117s);
|
||||
free(rlm_udp_vlog118s);
|
||||
free(rlm_udp_vlog119s);
|
||||
free(rlm_udp_vlog120s);
|
||||
}
|
||||
|
||||
|
||||
void rlm_udp_RLMPadDataSent(void *ptr,const struct rlm_svc *svc,
|
||||
const struct rlm_log *log,
|
||||
const struct rlm_pad *now,
|
||||
const struct rlm_pad *next)
|
||||
{
|
||||
int i;
|
||||
int flag=0;
|
||||
char msg[1500];
|
||||
|
||||
for(i=0;i<rlm_udp_devs;i++) {
|
||||
switch(rlm_udp_null_updates[i]) {
|
||||
case 0: /* Process all updates */
|
||||
break;
|
||||
|
||||
case 1: /* Process only non-null NOW updates */
|
||||
if(now->rlm_cartnum==0) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Process only non-null NEXT updates */
|
||||
if(next->rlm_cartnum==0) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: /* Process only non-null NOW and NEXT updates */
|
||||
if((now->rlm_cartnum==0)||(next->rlm_cartnum==0)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch(log->log_mach) {
|
||||
case 0:
|
||||
flag=rlm_udp_masters[i];
|
||||
break;
|
||||
|
||||
case 1:
|
||||
flag=rlm_udp_aux1s[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
flag=rlm_udp_aux2s[i];
|
||||
break;
|
||||
|
||||
case 100:
|
||||
flag=rlm_udp_vlog101s[i];
|
||||
break;
|
||||
|
||||
case 101:
|
||||
flag=rlm_udp_vlog102s[i];
|
||||
break;
|
||||
|
||||
case 102:
|
||||
flag=rlm_udp_vlog103s[i];
|
||||
break;
|
||||
|
||||
case 103:
|
||||
flag=rlm_udp_vlog104s[i];
|
||||
break;
|
||||
|
||||
case 104:
|
||||
flag=rlm_udp_vlog105s[i];
|
||||
break;
|
||||
|
||||
case 105:
|
||||
flag=rlm_udp_vlog106s[i];
|
||||
break;
|
||||
|
||||
case 106:
|
||||
flag=rlm_udp_vlog107s[i];
|
||||
break;
|
||||
|
||||
case 107:
|
||||
flag=rlm_udp_vlog108s[i];
|
||||
break;
|
||||
|
||||
case 108:
|
||||
flag=rlm_udp_vlog109s[i];
|
||||
break;
|
||||
|
||||
case 109:
|
||||
flag=rlm_udp_vlog110s[i];
|
||||
break;
|
||||
|
||||
case 110:
|
||||
flag=rlm_udp_vlog111s[i];
|
||||
break;
|
||||
|
||||
case 111:
|
||||
flag=rlm_udp_vlog112s[i];
|
||||
break;
|
||||
|
||||
case 112:
|
||||
flag=rlm_udp_vlog113s[i];
|
||||
break;
|
||||
|
||||
case 113:
|
||||
flag=rlm_udp_vlog114s[i];
|
||||
break;
|
||||
|
||||
case 114:
|
||||
flag=rlm_udp_vlog115s[i];
|
||||
break;
|
||||
|
||||
case 115:
|
||||
flag=rlm_udp_vlog116s[i];
|
||||
break;
|
||||
|
||||
case 116:
|
||||
flag=rlm_udp_vlog117s[i];
|
||||
break;
|
||||
|
||||
case 117:
|
||||
flag=rlm_udp_vlog118s[i];
|
||||
break;
|
||||
|
||||
case 118:
|
||||
flag=rlm_udp_vlog119s[i];
|
||||
break;
|
||||
|
||||
case 119:
|
||||
flag=rlm_udp_vlog120s[i];
|
||||
break;
|
||||
}
|
||||
if((flag==1)||((flag==2)&&(log->log_onair!=0))) {
|
||||
const char *str=
|
||||
RLMResolveNowNextEncoded(ptr,now,next,rlm_udp_formats+256*i,
|
||||
rlm_udp_encodings[i]);
|
||||
RLMSendUdp(ptr,rlm_udp_addresses+i*16,rlm_udp_ports[i],str,strlen(str));
|
||||
snprintf(msg,1500,"rlm_udp: sending pad update: \"%s\"",
|
||||
(const char *)str);
|
||||
RLMLog(ptr,LOG_INFO,msg);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user