mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-24 22:25:56 -05:00
Fix event dispatching across platforms, clean up icon on win32, update installer template.
This commit is contained in:
parent
f0434c8c8f
commit
7b19b6f533
@ -44,6 +44,7 @@
|
||||
#include "err.h"
|
||||
#ifndef ERR_LEAN
|
||||
# include "os.h"
|
||||
# include "plugin.h"
|
||||
#endif
|
||||
|
||||
#ifndef PACKAGE
|
||||
@ -154,7 +155,11 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
||||
os_syslog(level,errbuf);
|
||||
os_closesyslog();
|
||||
}
|
||||
|
||||
|
||||
#ifndef ERR_LEAN
|
||||
plugin_event_dispatch(PLUGIN_EVENT_LOG, level, errbuf, (int)strlen(errbuf)+1);
|
||||
#endif
|
||||
|
||||
_err_unlock();
|
||||
|
||||
if(!level) {
|
||||
|
@ -128,7 +128,6 @@ int os_closesyslog(void) {
|
||||
* @return TRUE on success, FALSE otherwise
|
||||
*/
|
||||
int os_syslog(int level, char *msg) {
|
||||
plugin_event_dispatch(PLUGIN_EVENT_LOG, level, msg, (int)strlen(msg)+1);
|
||||
return elog_message(level, msg);
|
||||
}
|
||||
|
||||
|
@ -555,10 +555,10 @@ int plugin_auth_handle(WS_CONNINFO *pwsc, char *username, char *pw) {
|
||||
void plugin_event_dispatch(int event_id, int intval, void *vp, int len) {
|
||||
PLUGIN_ENTRY *ppi;
|
||||
|
||||
_plugin_readlock();
|
||||
/* FIXME: Something is wrong is readlock deadlocks... */
|
||||
// _plugin_readlock();
|
||||
ppi = _plugin_list.next;
|
||||
while(ppi) {
|
||||
fprintf(stderr,"Checking %s\n",ppi->pinfo->server);
|
||||
if(ppi->pinfo->type & PLUGIN_EVENT) {
|
||||
/* DPRINTF(E_DBG,L_PLUG,"Dispatching event %d to %s\n",
|
||||
event_id,ppi->versionstring); */
|
||||
@ -569,7 +569,7 @@ void plugin_event_dispatch(int event_id, int intval, void *vp, int len) {
|
||||
}
|
||||
ppi=ppi->next;
|
||||
}
|
||||
_plugin_unlock();
|
||||
// _plugin_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,9 +11,6 @@ void plugin_handler(int, int, void *, int);
|
||||
|
||||
#define PIPE_BUFFER_SIZE 4096
|
||||
|
||||
#define USE_UDP 0
|
||||
#define USE_MAILSLOT 1
|
||||
|
||||
/* Globals */
|
||||
PLUGIN_EVENT_FN _pefn = { plugin_handler };
|
||||
PLUGIN_INPUT_FN *_ppi;
|
||||
@ -43,46 +40,6 @@ PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
||||
return &_pi;
|
||||
}
|
||||
|
||||
#if USE_UDP
|
||||
/** NO LOG IN HERE! We'll go into an endless loop. :) */
|
||||
void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
int total_len = 3 * sizeof(int) + len + 1;
|
||||
PLUGIN_MSG *pmsg;
|
||||
int port = 9999;
|
||||
SOCKET sock;
|
||||
struct sockaddr_in servaddr;
|
||||
|
||||
pmsg = (PLUGIN_MSG*)malloc(total_len);
|
||||
if(!pmsg) {
|
||||
// _ppi->log(E_LOG,"Malloc error in w32-event.c/plugin_handler\n");
|
||||
return;
|
||||
}
|
||||
|
||||
memset(pmsg,0,total_len);
|
||||
pmsg->size = total_len;
|
||||
pmsg->event_id = event_id;
|
||||
pmsg->intval = intval;
|
||||
memcpy(&pmsg->vp,vp,len);
|
||||
|
||||
sock = socket(AF_INET,SOCK_DGRAM,0);
|
||||
if(sock == INVALID_SOCKET) {
|
||||
free(pmsg);
|
||||
return;
|
||||
}
|
||||
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
servaddr.sin_port = htons(port);
|
||||
|
||||
sendto(sock,(char*)pmsg,total_len,0,(struct sockaddr *)&servaddr,sizeof(servaddr));
|
||||
|
||||
closesocket(sock);
|
||||
free(pmsg);
|
||||
return;
|
||||
}
|
||||
#endif /* USE_UDP */
|
||||
|
||||
#if USE_MAILSLOT
|
||||
#define MAILSLOT_NAME "\\\\.\\mailslot\\FireflyMediaServer--67A72768-4154-417e-BFA0-FA9B50C342DE"
|
||||
/** NO LOG IN HERE! We'll go into an endless loop. :) */
|
||||
void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
@ -120,4 +77,3 @@ void plugin_handler(int event_id, int intval, void *vp, int len) {
|
||||
CloseHandle(h);
|
||||
}
|
||||
}
|
||||
#endif /* USE_MAILSLOT */
|
||||
|
@ -138,7 +138,7 @@ void xml_update_config(WS_CONNINFO *pwsc) {
|
||||
}
|
||||
strcpy(badparms,arg);
|
||||
} else {
|
||||
badparms_len += strlen(arg) + 1;
|
||||
badparms_len += (int)strlen(arg) + 1;
|
||||
badparms = (char*)realloc(badparms,badparms_len);
|
||||
if(!badparms) {
|
||||
DPRINTF(E_FATAL,L_MISC,"xml_update_config: malloc\n");
|
||||
|
BIN
win32/ff.ico
BIN
win32/ff.ico
Binary file not shown.
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 35 KiB |
@ -57,6 +57,8 @@
|
||||
; MUI end ------
|
||||
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
Icon "..\ff.ico"
|
||||
UninstallIcon "..\ff.ico"
|
||||
OutFile "${PRODUCT_NAME} (${PRODUCT_VERSION}).exe"
|
||||
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
|
||||
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
||||
@ -89,12 +91,13 @@ Section -Pre
|
||||
|
||||
lbl_continue:
|
||||
; should really loop until service stops...
|
||||
DetailPrint "Service is stopped..."
|
||||
Sleep 1000
|
||||
DetailPrint "Sent stop message... waiting for stop"
|
||||
Sleep 5000
|
||||
|
||||
|
||||
!include WinMessages.nsh
|
||||
FindWindow $0 "" "Firefly Config"
|
||||
SendMessage $0 ${WM_USER} 0 0
|
||||
FindWindow $0 "" "FireflyShellNotifyIconHidden"
|
||||
SendMessage $0 ${WM_CLOSE} 0 0
|
||||
nsSCM::QueryStatus "Bonjour Service"
|
||||
Pop $0
|
||||
Pop $1
|
||||
@ -186,6 +189,14 @@ HasConf:
|
||||
rescan_set:
|
||||
WriteINIStr "$2\mt-daapd.conf" "general" "rescan_interval" "600"
|
||||
rescan_skip:
|
||||
|
||||
ReadINIStr $0 "$2\mt-daapd.conf" "general" "logfile"
|
||||
StrCmp $0 "" logfile_set logfile_skip
|
||||
|
||||
logfile_set:
|
||||
WriteINIStr "$2\mt-daapd.conf" "general" "logfile" "firefly.log"
|
||||
logfile_skip:
|
||||
|
||||
SetAutoClose False
|
||||
SectionEnd
|
||||
|
||||
@ -197,6 +208,9 @@ Section -AdditionalIcons
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Debug Mode.lnk" "$2\firefly.exe" "-d9 -f"
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Firefly Configuration.lnk" "$2\FireflyShell.exe"
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Advanced Configuration.lnk" "notepad.exe" "$2\mt-daapd.conf"
|
||||
|
||||
Delete "$SMPROGRAMS\Startup\Firefly Configuration.lnk"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section -Post
|
||||
@ -224,7 +238,7 @@ Section -Post
|
||||
ExecWait 'netsh firewall add allowedprogram "$2\firefly.exe" "${PRODUCT_NAME}" enable'
|
||||
|
||||
nsSCM::Start "${PRODUCT_NAME}"
|
||||
Exec "$2\FireflyShell.exe"
|
||||
Exec '"$2\FireflyShell.exe" -q'
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user