diff --git a/src/main.c b/src/main.c index 3a57c958..757cf5d2 100644 --- a/src/main.c +++ b/src/main.c @@ -442,6 +442,9 @@ int main(int argc, char *argv[]) { iface = conf_alloc_string("general","interface",""); rend_register(servername,"_daap._tcp",ws_config.port,iface,txtrecord); rend_register(servername,"_http._tcp",ws_config.port,iface,txtrecord); + + plugin_rend_register(servername,ws_config.port,iface); + free(servername); free(iface); } diff --git a/src/plugin.c b/src/plugin.c index 00578401..1894685a 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -37,6 +37,7 @@ #include "err.h" #include "os.h" #include "plugin.h" +#include "rend.h" #include "smart-parser.h" #include "xml-rpc.h" #include "webserver.h" @@ -47,6 +48,7 @@ typedef struct tag_pluginentry { char *versionstring; regex_t regex; void *functions; + PLUGIN_REND_INFO **rend_info; struct tag_pluginentry *next; } PLUGIN_ENTRY; @@ -236,6 +238,7 @@ int plugin_load(char **pe, char *path) { } } ppi->functions = pinfo->handler_functions; + ppi->rend_info = pinfo->rend_info; DPRINTF(E_INF,L_PLUG,"Loaded plugin %s (%s)\n",path,ppi->versionstring); pinfo->pi = (void*)π @@ -305,8 +308,8 @@ void plugin_url_handle(WS_CONNINFO *pwsc) { _plugin_unlock(); return; } - ppi = ppi->next; } + ppi = ppi->next; } /* should 500 here or something */ @@ -315,6 +318,35 @@ void plugin_url_handle(WS_CONNINFO *pwsc) { return; } +/** + * walk through the plugins and register whatever rendezvous + * names the clients want + */ +int plugin_rend_register(char *name, int port, char *iface) { + PLUGIN_ENTRY *ppi; + PLUGIN_REND_INFO *pri; + + _plugin_readlock(); + ppi = _plugin_list.next; + + while(ppi) { + DPRINTF(E_DBG,L_PLUG,"Checking %s\n",ppi->versionstring); + if(ppi->rend_info) { + pri = *(ppi->rend_info); + while(pri->type) { + DPRINTF(E_DBG,L_PLUG,"Registering %s\n",pri->type); + rend_register(name,pri->type,port,iface,pri->txt); + pri++; + } + } + ppi=ppi->next; + } + + _plugin_unlock(); + + return TRUE; +} + /** * Test password for the handled namespace * @@ -348,8 +380,8 @@ int plugin_auth_handle(WS_CONNINFO *pwsc, char *username, char *pw) { return TRUE; } } - ppi = ppi->next; } + ppi = ppi->next; } /* should 500 here or something */ diff --git a/src/plugin.h b/src/plugin.h index 5025f97b..bbb31ac1 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -33,6 +33,8 @@ extern int plugin_deinit(void); extern int plugin_url_candispatch(WS_CONNINFO *pwsc); extern void plugin_url_handle(WS_CONNINFO *pwsc); extern int plugin_auth_handle(WS_CONNINFO *pwsc, char *username, char *pw); +extern int plugin_rend_register(char *name, int port, char *iface); + #define PLUGIN_E_SUCCESS 0 #define PLUGIN_E_NOLOAD 1 @@ -52,6 +54,11 @@ typedef struct tag_plugin_output_fn { } PLUGIN_OUTPUT_FN; /* version 1 plugin info */ +typedef struct tag_plugin_rend_info { + char *type; + char *txt; +} PLUGIN_REND_INFO; + typedef struct tag_plugin_info { int version; int type; @@ -59,6 +66,7 @@ typedef struct tag_plugin_info { char *url; /* for output plugins */ void *handler_functions; void *pi; /* exported functions */ + PLUGIN_REND_INFO **rend_info; } PLUGIN_INFO; /* version 1 plugin imports */ diff --git a/src/plugins/mtd-plugins.h b/src/plugins/mtd-plugins.h index a988667f..8d138248 100644 --- a/src/plugins/mtd-plugins.h +++ b/src/plugins/mtd-plugins.h @@ -23,6 +23,11 @@ typedef struct tag_plugin_output_fn { int(*auth)(WS_CONNINFO *pwsc, char *username, char *pw); } PLUGIN_OUTPUT_FN; +typedef struct tag_plugin_rend_info { + char *type; + char *txt; +} PLUGIN_REND_INFO; + typedef struct tag_plugin_info { int version; int type; @@ -30,6 +35,7 @@ typedef struct tag_plugin_info { char *url; /* regex of namespace to handle if OUTPUT type */ void *handler_functions; void *fn; /* input functions*/ + PLUGIN_REND_INFO **rend_info; } PLUGIN_INFO; /* xml helpers for output plugins */ diff --git a/win32/mt-daapd.vcproj b/win32/mt-daapd.vcproj index d14b97a2..41e6d749 100644 --- a/win32/mt-daapd.vcproj +++ b/win32/mt-daapd.vcproj @@ -254,6 +254,9 @@ + + diff --git a/win32/nsi/mt-daapd.nsi b/win32/nsi/mt-daapd.nsi index 8858f7f7..08f4e0f8 100644 --- a/win32/nsi/mt-daapd.nsi +++ b/win32/nsi/mt-daapd.nsi @@ -57,6 +57,10 @@ InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show +!define PROJROOT "..\..\.." +!define MTD_SOURCE "${PROJROOT}\mt-daapd\win32\Release" +!define DLL_SOURCE "${PROJROOT}\win32\dll" +!define ADMIN_ROOT "${PROJROOT}\mt-daapd\admin-root" Section -Pre nsSCM::QueryStatus "Bonjour Service" @@ -73,61 +77,61 @@ SectionEnd Section "MainSection" SEC01 SetOutPath "$2" SetOverwrite ifnewer - File "..\Release\mt-daapd.exe" - File "..\..\..\win32\dll\gnu_regex.dll" - File "..\..\..\win32\dll\pthreadVC2.dll" - File "..\..\..\win32\dll\sqlite.dll" - File "..\..\..\win32\dll\sqlite3.dll" - File "..\..\..\win32\dll\zlib.dll" + File "${MTD_SOURCE}\mt-daapd.exe" + File "${DLL_SOURCE}\gnu_regex.dll" + File "${DLL_SOURCE}\pthreadVC2.dll" + File "${DLL_SOURCE}\sqlite.dll" + File "${DLL_SOURCE}\sqlite3.dll" + File "${DLL_SOURCE}\zlib1.dll" SetOutPath "$2\admin-root" - File "..\..\admin-root\thanks.html" - File "..\..\admin-root\status.html" - File "..\..\admin-root\smartpopup.html" - File "..\..\admin-root\smart.js" - File "..\..\admin-root\smart.html" - File "..\..\admin-root\required.gif" - File "..\..\admin-root\playlist.js" - File "..\..\admin-root\playlist.html" - File "..\..\admin-root\mt-daapd.png" - File "..\..\admin-root\mt-daapd.js" - File "..\..\admin-root\mt-daapd.css" - File "..\..\admin-root\linkTransparent.gif" - File "..\..\admin-root\linkOpaque.gif" - File "..\..\admin-root\index.html" - File "..\..\admin-root\hdr.html" - File "..\..\admin-root\gpl-license.txt" - File "..\..\admin-root\gpl-license.html" - File "..\..\admin-root\ftr.html" - File "..\..\admin-root\feedback.html" - File "..\..\admin-root\favicon.ico" - File "..\..\admin-root\DAAPApplet-0.1.jar" - File "..\..\admin-root\CREDITS" - File "..\..\admin-root\config-update.html" - File "..\..\admin-root\config.html" - File "..\..\admin-root\config.js" - File "..\..\admin-root\aspl-license.txt" - File "..\..\admin-root\aspl-license.html" - File "..\..\admin-root\applet.html" - File "..\..\admin-root\smart.js" + File "${ADMIN_ROOT}\thanks.html" + File "${ADMIN_ROOT}\status.html" + File "${ADMIN_ROOT}\smartpopup.html" + File "${ADMIN_ROOT}\smart.js" + File "${ADMIN_ROOT}\smart.html" + File "${ADMIN_ROOT}\required.gif" + File "${ADMIN_ROOT}\playlist.js" + File "${ADMIN_ROOT}\playlist.html" + File "${ADMIN_ROOT}\mt-daapd.png" + File "${ADMIN_ROOT}\mt-daapd.js" + File "${ADMIN_ROOT}\mt-daapd.css" + File "${ADMIN_ROOT}\linkTransparent.gif" + File "${ADMIN_ROOT}\linkOpaque.gif" + File "${ADMIN_ROOT}\index.html" + File "${ADMIN_ROOT}\hdr.html" + File "${ADMIN_ROOT}\gpl-license.txt" + File "${ADMIN_ROOT}\gpl-license.html" + File "${ADMIN_ROOT}\ftr.html" + File "${ADMIN_ROOT}\feedback.html" + File "${ADMIN_ROOT}\favicon.ico" + File "${ADMIN_ROOT}\DAAPApplet-0.1.jar" + File "${ADMIN_ROOT}\CREDITS" + File "${ADMIN_ROOT}\config-update.html" + File "${ADMIN_ROOT}\config.html" + File "${ADMIN_ROOT}\config.js" + File "${ADMIN_ROOT}\aspl-license.txt" + File "${ADMIN_ROOT}\aspl-license.html" + File "${ADMIN_ROOT}\applet.html" + File "${ADMIN_ROOT}\smart.js" SetOutPath "$2\admin-root\lib-js" - File "..\..\admin-root\lib-js\prototype.js" - File "..\..\admin-root\lib-js\rico.js" + File "${ADMIN_ROOT}\lib-js\prototype.js" + File "${ADMIN_ROOT}\lib-js\rico.js" SetOutPath "$2\admin-root\lib-js\script.aculo.us" - File "..\..\admin-root\lib-js\script.aculo.us\builder.js" - File "..\..\admin-root\lib-js\script.aculo.us\controls.js" - File "..\..\admin-root\lib-js\script.aculo.us\dragdrop.js" - File "..\..\admin-root\lib-js\script.aculo.us\effects.js" - File "..\..\admin-root\lib-js\script.aculo.us\scriptaculous.js" - File "..\..\admin-root\lib-js\script.aculo.us\slider.js" - File "..\..\admin-root\lib-js\script.aculo.us\unittest.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\builder.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\controls.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\dragdrop.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\effects.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\scriptaculous.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\slider.js" + File "${ADMIN_ROOT}\lib-js\script.aculo.us\unittest.js" SetOutPath "$2" File "mt-daapd-example.conf" IfFileExists "$2\mt-daapd.conf" HasConf SetOverwrite off CopyFiles "$2\mt-daapd-example.conf" "$2\mt-daapd.conf" -HasConf: WriteINIStr "$2\mt-daapd.conf" "general" "mp3_dir" $3 +HasConf: SetAutoClose False SectionEnd @@ -160,6 +164,8 @@ Section -Post MessageBox MB_OK "Error installing service: $1" lbl_install_success: + nsSCM::Start "${PRODUCT_NAME}" + SectionEnd @@ -207,7 +213,7 @@ MusicDirectoryPage: StrCpy $9 "2" !insertmacro MUI_HEADER_TEXT "Choose Music Location" "Choose the folder containing music to share." !insertmacro MUI_INNERDIALOG_TEXT 1041 "Music Folder" - !insertmacro MUI_INNERDIALOG_TEXT 1019 "C:\Documents and Settings" + !insertmacro MUI_INNERDIALOG_TEXT 1019 "$DOCUMENTS\My Music" !insertmacro MUI_INNERDIALOG_TEXT 1006 "Setup will share the music in the following folder.$\r$\n$\r$\nTo share a different folder, click Browse and select another folder. Click Install to start the installation." EndDirectoryShow: FunctionEnd @@ -222,7 +228,9 @@ SaveInstallDir: Goto EndDirectoryLeave SaveMusicDir: - StrCpy $3 $INSTDIR + Push $INSTDIR + Call GetParent + Pop $3 EndDirectoryLeave: FunctionEnd @@ -249,6 +257,44 @@ FunctionEnd ;-------------------------------- ;Helper Functions +; GetParent +; input, top of stack (e.g. C:\Program Files\Poop) +; output, top of stack (replaces, with e.g. C:\Program Files) +; modifies no other variables. +; +; Usage: +; Push "C:\Program Files\Directory\Whatever" +; Call GetParent +; Pop $R0 +; ; at this point $R0 will equal "C:\Program Files\Directory" +Function GetParent + + Exch $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R1 0 + StrLen $R2 $R0 + + loop: + IntOp $R1 $R1 + 1 + IntCmp $R1 $R2 get 0 get + StrCpy $R3 $R0 1 -$R1 + StrCmp $R3 "\" get + Goto loop + + get: + StrCpy $R0 $R0 -$R1 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 + +FunctionEnd + + Function GetRoot Exch $0 Push $1 @@ -300,9 +346,9 @@ Section Uninstall Delete "$INSTDIR\gnu_regex.dll" Delete "$INSTDIR\pthreadVC2.dll" Delete "$INSTDIR\sqlite.dll" - Delete "$INSTDIR\sqlie3.dll" + Delete "$INSTDIR\sqlite3.dll" Delete "$INSTDIR\mt-daapd.conf" - Delete "$INSTDIR\zlib.dll" + Delete "$INSTDIR\zlib1.dll" Delete "$INSTDIR\mt-daapd-example.conf" Delete "$INSTDIR\admin-root\applet.html" Delete "$INSTDIR\admin-root\aspl-license.html"