1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into plugins

This commit is contained in:
James Booth 2014-03-05 00:14:14 +00:00
commit 02ef4d31be
3 changed files with 59 additions and 12 deletions

View File

@ -24,7 +24,13 @@ AC_PROG_CC
### Get canonical host ### Get canonical host
AC_CANONICAL_HOST AC_CANONICAL_HOST
AS_IF([test "x$host_os" = xcygwin], PLATFORM="unknown"
AS_CASE([$host_os],
[darwin*], [PLATFORM="osx"],
[cygwin], [PLATFORM="cygwin"],
[PLATFORM="nix"])
AS_IF([test "x$PLATFORM" = xcygwin],
[AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])]) [AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
### Options ### Options
@ -210,12 +216,28 @@ PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.26], [],
[AC_MSG_ERROR([glib 2.26 or higher is required for profanity])]) [AC_MSG_ERROR([glib 2.26 or higher is required for profanity])])
PKG_CHECK_MODULES([curl], [libcurl], [], PKG_CHECK_MODULES([curl], [libcurl], [],
[AC_MSG_ERROR([libcurl is required for profanity])]) [AC_MSG_ERROR([libcurl is required for profanity])])
AS_IF([test "x$enable_notifications" != xno],
### Check for desktop notification support
### Linux requires libnotify
### Windows uses native OS calls
### OSX requires terminal-notifier
AS_IF([test "x$PLATFORM" = xosx],
[AS_IF([test "x$enable_notifications" != xno],
[NOTIFIER_PATH="no"
AC_PATH_PROG(NOTIFIER_PATH, terminal-notifier, no)
AS_IF([test "x$NOTIFIER_PATH" = xno],
[AS_IF([test "x$enable_notifications" = xyes],
[AC_MSG_ERROR([terminal-notifier not found, required for desktop notifications.])],
[AC_MSG_NOTICE([Desktop notifications not supported.])])],
[AC_DEFINE([HAVE_OSXNOTIFY], [1], [terminal notifier])])])],
[test "x$PLATFORM" = xnix],
[AS_IF([test "x$enable_notifications" != xno],
[PKG_CHECK_MODULES([libnotify], [libnotify], [PKG_CHECK_MODULES([libnotify], [libnotify],
[AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])], [AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify module])],
[AS_IF([test "x$enable_notifications" = xyes], [AS_IF([test "x$enable_notifications" = xyes],
[AC_MSG_ERROR([libnotify is required but does not exist])], [AC_MSG_ERROR([libnotify is required but does not exist])],
[AC_MSG_NOTICE([libnotify support will be disabled])])])]) [AC_MSG_NOTICE([libnotify support will be disabled])])])])])
# TODO: rewrite this # TODO: rewrite this
if test "x$with_xscreensaver" = xyes; then if test "x$with_xscreensaver" = xyes; then
@ -262,7 +284,7 @@ elif test "x$enable_otr" = x; then
]])], ]])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR4], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])], [AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR4], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])], [AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])],
[AC_MSG_NOTICE([libotr not found, otr entryption support not enabled])]) [AC_MSG_NOTICE([libotr not found, otr encryption support not enabled])])
fi fi
### cmocka is required only for tests, profanity shouldn't be linked with it ### cmocka is required only for tests, profanity shouldn't be linked with it
@ -294,6 +316,7 @@ AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT
echo "" echo ""
echo "PLATFORM : $host_os"
echo "PACKAGE_STATUS : $PACKAGE_STATUS" echo "PACKAGE_STATUS : $PACKAGE_STATUS"
echo "AM_CFLAGS : $AM_CFLAGS" echo "AM_CFLAGS : $AM_CFLAGS"
echo "AM_CPPFLAGS : $AM_CPPFLAGS" echo "AM_CPPFLAGS : $AM_CPPFLAGS"

View File

@ -51,14 +51,12 @@ cygwin_prepare()
mv apt-cyg /usr/local/bin/ mv apt-cyg /usr/local/bin/
if [ -n "$CYG_MIRROR" ]; then if [ -n "$CYG_MIRROR" ]; then
apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel apt-cyg -m $CYG_MIRROR install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel
else else
apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel apt-cyg install git make gcc-core m4 automake autoconf pkg-config openssl-devel libexpat-devel zlib-devel libncursesw-devel libglib2.0-devel libcurl-devel libidn-devel libssh2-devel libkrb5-devel openldap-devel libgcrypt-devel
fi fi
ln -s /usr/bin/gcc-3.exe /usr/bin/gcc.exe
export LIBRARY_PATH=/usr/local/lib/ export LIBRARY_PATH=/usr/local/lib/
} }

View File

@ -23,6 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <glib.h> #include <glib.h>
#ifdef PROF_HAVE_LIBNOTIFY #ifdef PROF_HAVE_LIBNOTIFY
@ -202,6 +203,31 @@ _notify(const char * const message, int timeout,
Shell_NotifyIcon(NIM_MODIFY, &nid); Shell_NotifyIcon(NIM_MODIFY, &nid);
#endif #endif
#ifdef HAVE_OSXNOTIFY
GString *notify_command = g_string_new("terminal-notifier -title 'Profanity' -message '");
g_string_append(notify_command, message);
g_string_append(notify_command, "'");
char *term_name = getenv("TERM_PROGRAM");
char *app_id = NULL;
if (g_strcmp0(term_name, "Apple_Terminal") == 0) {
app_id = "com.apple.Terminal";
} else if (g_strcmp0(term_name, "iTerm.app") == 0) {
app_id = "com.googlecode.iterm2";
}
if (app_id != NULL) {
g_string_append(notify_command, " -sender ");
g_string_append(notify_command, app_id);
}
int res = system(notify_command->str);
if (res == -1) {
log_error("Could not send desktop notificaion.");
}
g_string_free(notify_command, TRUE);
#endif
} }
void void