Permalink
Browse files

Set plugin actions for XChat Aqua

  • Loading branch information...
1 parent ed7880c commit d3adc48ec7f3d1cd8b6ab52ee10c14a09b899e3d @youknowone youknowone committed Jun 18, 2012
Showing with 30 additions and 4 deletions.
  1. +1 −1 config.h
  2. +1 −1 src/common/ctcp.c
  3. +2 −0 src/common/outbound.c
  4. +22 −2 src/common/plugin.c
  5. +4 −0 src/common/util.c
View
@@ -422,7 +422,7 @@
/* #undef USING_LINUX */
-#define XCHATLIBDIR "/tmp/local/lib/xchat"
+#define XCHATLIBDIR get_appdir_fs()
#define XCHATSHAREDIR "${prefix}/share"
View
@@ -134,7 +134,7 @@ ctcp_handle (session *sess, char *to, char *nick, char *ip,
if (!strcasecmp (msg, "VERSION") && !prefs.hidever)
{
-#ifdef FE_AQUA || FE_IOS
+#if defined(FE_AQUA) || defined(FE_IOS)
snprintf (outbuf, sizeof (outbuf), "VERSION X-Chat Aqua "XCHAT_AQUA_VERSION_STRING" (xchat "PACKAGE_VERSION") %s", get_cpu_str ());
#else
snprintf (outbuf, sizeof (outbuf), "VERSION xchat "PACKAGE_VERSION" %s",
View
@@ -2460,6 +2460,8 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
#else
#if defined(__hpux)
if (len > 3 && strcasecmp (".sl", word[2] + len - 3) == 0)
+#elif defined (FE_AQUA)
+ if (len > 3 && strcasecmp (".so", word[2] + len - 3) == 0 || len > 7 && strcasecmp (".bundle", word[2] + len - 7) == 0)
#else
if (len > 3 && strcasecmp (".so", word[2] + len - 3) == 0)
#endif
View
@@ -40,6 +40,12 @@ typedef struct session xchat_context;
#include "xchatc.h"
+#ifdef __APPLE__
+extern char *get_appdir_fs();
+extern char *get_appplugindir_fs();
+extern char *get_plugin_bundle_path(char *filename);
+#endif
+
/* the USE_PLUGIN define only removes libdl stuff */
#ifdef USE_PLUGIN
@@ -372,6 +378,16 @@ plugin_load (session *sess, char *filename, char *arg)
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
+
+#ifdef __APPLE__
+ int filenamelen = strlen(filename);
+ if (filenamelen > 7 && strcasecmp(".bundle", filename + filenamelen - 7) == 0) {
+ filename = get_plugin_bundle_path(filename);
+ if (filename == NULL) {
+ return _("Invalid Mac OS X bundle or required Mac OS X version is not satisfied");
+ }
+ }
+#endif
/* get the filename without path */
filepart = file_part (filename);
@@ -441,8 +457,12 @@ plugin_auto_load (session *sess)
for_files (get_xdir_fs (), "*.sl", plugin_auto_load_cb);
#elif defined(FE_AQUA) || defined(FE_IOS)
//TODO: hide plugins into app bundle
- for_files ("./plugins", "*.so", plugin_auto_load_cb); // X-Chat Aqua
- for_files (get_xdir_fs (), "*.so", plugin_auto_load_cb);
+ for_files (get_appplugindir_fs(), "*.bundle", plugin_auto_load_cb); // X-Chat Aqua
+ int len = strlen(get_xdir_fs()) + 10;
+ char buf[len];
+ strcpy(buf, get_xdir_fs());
+ strcat(buf, "/plugins");
+ for_files (buf, "*.bundle", plugin_auto_load_cb); // User configuration
#else
for_files (XCHATLIBDIR"/plugins", "*.so", plugin_auto_load_cb);
for_files (get_xdir_fs (), "*.so", plugin_auto_load_cb);
View
@@ -807,7 +807,11 @@ for_files (char *dirname, char *mask, void callback (char *file))
{
while ((ent = readdir (dir)))
{
+ #if defined(FE_AQUA) || defined(FE_IOS)
+ if (ent->d_name[0] != '.')
+ #else
if (strcmp (ent->d_name, ".") && strcmp (ent->d_name, ".."))
+ #endif
{
if (match (mask, ent->d_name))
{

0 comments on commit d3adc48

Please sign in to comment.