From nobody at rubyforge.org Sun Jan 13 16:28:43 2008 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 13 Jan 2008 16:28:43 -0500 (EST) Subject: [Ruburple-submits] [50] trunk/ruburple/ext/extconf.rb: On certain version of OS X / Darwin, we need to link Message-ID: <20080113212843.BFD9D18585F3@rubyforge.org> Revision: 50 Author: joe_edelman Date: 2008-01-13 16:28:43 -0500 (Sun, 13 Jan 2008) Log Message: ----------- On certain version of OS X / Darwin, we need to link explicitly against gthread, otherwise we get an error like: GLib-ERROR **: The thread system is not yet initialized So here we do that. Modified Paths: -------------- trunk/ruburple/ext/extconf.rb Modified: trunk/ruburple/ext/extconf.rb =================================================================== --- trunk/ruburple/ext/extconf.rb 2007-12-07 12:42:20 UTC (rev 49) +++ trunk/ruburple/ext/extconf.rb 2008-01-13 21:28:43 UTC (rev 50) @@ -32,8 +32,12 @@ crash "libglib-2.0 needed" end -$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags --libs glib-2.0`.strip +unless have_library('gthread-2.0') + crash "gthread-2.0 needed" +end +$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags --libs glib-2.0 gthread-2.0`.strip + unless find_header("libpurple/core.h", "/usr/include", "/usr/local/include", "/opt/local/include") crash "libpurple needed" end From nobody at rubyforge.org Sun Jan 13 16:40:21 2008 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 13 Jan 2008 16:40:21 -0500 (EST) Subject: [Ruburple-submits] [51] trunk/ruburple/ext/extconf.rb: fixed the annoying complaint about unused linker flags Message-ID: <20080113214021.E201E18585F1@rubyforge.org> Revision: 51 Author: zond Date: 2008-01-13 16:40:21 -0500 (Sun, 13 Jan 2008) Log Message: ----------- fixed the annoying complaint about unused linker flags Modified Paths: -------------- trunk/ruburple/ext/extconf.rb Modified: trunk/ruburple/ext/extconf.rb =================================================================== --- trunk/ruburple/ext/extconf.rb 2008-01-13 21:28:43 UTC (rev 50) +++ trunk/ruburple/ext/extconf.rb 2008-01-13 21:40:21 UTC (rev 51) @@ -36,7 +36,8 @@ crash "gthread-2.0 needed" end -$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags --libs glib-2.0 gthread-2.0`.strip +$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags glib-2.0 gthread-2.0`.strip +$LIBS += " " + `pkg-config --libs glib-2.0 gthread-2.0`.strip unless find_header("libpurple/core.h", "/usr/include", "/usr/local/include", "/opt/local/include") crash "libpurple needed" From nobody at rubyforge.org Mon Jan 21 11:01:31 2008 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Mon, 21 Jan 2008 11:01:31 -0500 (EST) Subject: [Ruburple-submits] [52] trunk/ruburple: Added some instructions for people having trouble on Mac OS X. Message-ID: <20080121160131.B632718585D6@rubyforge.org> Revision: 52 Author: joe_edelman Date: 2008-01-21 11:01:31 -0500 (Mon, 21 Jan 2008) Log Message: ----------- Added some instructions for people having trouble on Mac OS X. Modified Paths: -------------- trunk/ruburple/ext/extconf.rb Added Paths: ----------- trunk/ruburple/INSTALL.macos Added: trunk/ruburple/INSTALL.macos =================================================================== --- trunk/ruburple/INSTALL.macos (rev 0) +++ trunk/ruburple/INSTALL.macos 2008-01-21 16:01:31 UTC (rev 52) @@ -0,0 +1,109 @@ +Here are some helpful directions for installing on Mac OS X from SVN / or if the gem doesn't build. + +### make sure you have glib2 & pkg-config + +if you have fink: + + sudo fink install glib2-dev + sudo fink install pkgconfig + +otherwise, you can follow the directions for glib and pkg-config on this page: + + http://code.google.com/p/macfuse/wiki/HOWTO + +NOTE: if you install glib through macports, see the note about compiling ruburple below + + +### download and unpack the latest version of pidgin (which contains libpurple), here: + + http://pidgin.im/download/source/ + +or at the shell, something like + + mkdir -p /src + cd /src + wget http://downloads.sourceforge.net/pidgin/pidgin-2.3.1.tar.bz2 + tar xjf pidgin-2.3.1.tar.bz2 + cd pidgin-2.3.1 + +and then build and install libpurple in /usr/local/lib + + ./configure --disable-gtkui --disable-screensaver --disable-consoleui --disable-sm --disable-perl --disable-tk --disable-tcl --disable-gstreamer --disable-schemas-install --disable-gestures --disable-cap --disable-gevolution --disable-gtkspell --disable-startup-notification + cd libpurple + make + sudo make install + + +### get the latest ruburple code out of subversion + + cd /src + svn checkout http://ruburple.rubyforge.org/svn/trunk/ruburple + cd ruburple + +### build the C extension part of ruburple + + cd ext + ruby extconf.rb + make + sudo make install + +If the above doesn't work for you, there may be several causes: + + (1) if you use an intel mac, and you used a package manager to install glib and/or pkg-config, + it's likely you don't have universal binary version of those libraries. to compile an + intel-only version of ruburple, do: + + export ARCHFLAGS="-arch i386" + + and try the above again + + (2) if you specifically used macports to install glib/pkg-config, you need to tell extconf.rb how + to find the macports versions of those libraries. do: + + export LDFLAGS="-L/opt/local/lib" + + and try again. You may need to do both of the above. + + +### copy over the ruby part of ruburple + +this part depends on whether you have a custom ruby binary installed on your system. to find out: + + which ruby + +you should see either something like "/usr/local/bin/ruby" or "/usr/bin/ruby". copy ruburple to the matching site_ruby directory, either: + + sudo cp -R lib/ruburple.rb lib/ruburple /usr/local/lib/ruby/site_ruby/1.8/ + +or, for /usr/bin/ruby + + sudo cp -R lib/ruburple.rb lib/ruburple /usr/lib/ruby/site_ruby/1.8/ + + +### try it out + + irb -rruburple + +and then try things like + + Ruburple::init + Ruburple::debug = true + a = Ruburple::get_protocol("AIM").get_account("your_screenname", "your_password") + a.connect + + +### (optional) add support for SSL + +the instructions above build a version of libpurple that can't talk to Google Talk and MSN because it doesn't support SSL. if you want to build an SSL capable version of libpurple, you need to have gnutls + + sudo port install gnutls + +and then redo the configure and install of libpurple with some extra config options + + cd /src/pidgin-2.3.1 + ./configure --disable-gtkui --disable-screensaver --disable-consoleui --disable-sm --disable-perl --disable-tk --disable-tcl --disable-gstreamer --disable-schemas-install --disable-gestures --disable-cap --disable-gevolution --disable-gtkspell --disable-startup-notification --with-gnutls-includes=/opt/local/include/ --with-gnutls-libs=/opt/local/lib/ + cd libpurple + make + sudo make install + +ruburple should use the new version of libpurple automatically. Modified: trunk/ruburple/ext/extconf.rb =================================================================== --- trunk/ruburple/ext/extconf.rb 2008-01-13 21:40:21 UTC (rev 51) +++ trunk/ruburple/ext/extconf.rb 2008-01-21 16:01:31 UTC (rev 52) @@ -24,6 +24,9 @@ exit 1 end +$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags glib-2.0 gthread-2.0`.strip +$LIBS += " " + `pkg-config --libs glib-2.0 gthread-2.0`.strip + unless find_executable("pkg-config") crash("pkg-config needed") end @@ -36,9 +39,6 @@ crash "gthread-2.0 needed" end -$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags glib-2.0 gthread-2.0`.strip -$LIBS += " " + `pkg-config --libs glib-2.0 gthread-2.0`.strip - unless find_header("libpurple/core.h", "/usr/include", "/usr/local/include", "/opt/local/include") crash "libpurple needed" end From nobody at rubyforge.org Mon Jan 21 11:15:28 2008 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Mon, 21 Jan 2008 11:15:28 -0500 (EST) Subject: [Ruburple-submits] [53] trunk/ruburple/ext/extconf.rb: made find_executable run before the executable itself Message-ID: <20080121161528.725321858605@rubyforge.org> Revision: 53 Author: zond Date: 2008-01-21 11:15:28 -0500 (Mon, 21 Jan 2008) Log Message: ----------- made find_executable run before the executable itself Modified Paths: -------------- trunk/ruburple/ext/extconf.rb Modified: trunk/ruburple/ext/extconf.rb =================================================================== --- trunk/ruburple/ext/extconf.rb 2008-01-21 16:01:31 UTC (rev 52) +++ trunk/ruburple/ext/extconf.rb 2008-01-21 16:15:28 UTC (rev 53) @@ -24,13 +24,13 @@ exit 1 end -$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags glib-2.0 gthread-2.0`.strip -$LIBS += " " + `pkg-config --libs glib-2.0 gthread-2.0`.strip - unless find_executable("pkg-config") crash("pkg-config needed") end +$CFLAGS += " -g -gdwarf-2 -g3 " + `pkg-config --cflags glib-2.0 gthread-2.0`.strip +$LIBS += " " + `pkg-config --libs glib-2.0 gthread-2.0`.strip + unless have_library('glib-2.0') crash "libglib-2.0 needed" end From nobody at rubyforge.org Sun Jan 27 20:39:43 2008 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 27 Jan 2008 20:39:43 -0500 (EST) Subject: [Ruburple-submits] [54] trunk/ruburple/ext/ruburple_ext.c: This is kind of an unsavory patch, but it makes ruburple work with Gmail Chat. Message-ID: <20080128013943.BF1BA185863A@rubyforge.org> Revision: 54 Author: joe_edelman Date: 2008-01-27 20:39:43 -0500 (Sun, 27 Jan 2008) Log Message: ----------- This is kind of an unsavory patch, but it makes ruburple work with Gmail Chat. Google's SSL certificates are for the hostname "gmail.com", but XMPP connections are for "talk.google.com" or the like. libpurple thinks that's worth putting up a dialog box and asking the user for confirmation. ruburple doesn't support the purple_request_* family of user interaction functions. What this patch does is blindly press the first button of any dialog box that libpurple wants to show. Throughout the libpurple code, the first button is the one that means "continue" (e.g., "accept", "ok) so that's not an entirely unreasonable thing to do. Modified Paths: -------------- trunk/ruburple/ext/ruburple_ext.c Modified: trunk/ruburple/ext/ruburple_ext.c =================================================================== --- trunk/ruburple/ext/ruburple_ext.c 2008-01-21 16:15:28 UTC (rev 53) +++ trunk/ruburple/ext/ruburple_ext.c 2008-01-28 01:39:43 UTC (rev 54) @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -351,7 +352,25 @@ }; /*** End of the eventloop functions. ***/ + +/* this function blindly presses the first button of whatever dialogue box + libpurple wants us to show! That's crazy! */ static gpointer +ruburple_request_blindly_accept(const char *title, const char *primary, const char *secondary, + int default_action, + PurpleAccount *account, const char *who, PurpleConversation *conv, + void *user_data, size_t action_count, va_list actions) +{ + GCallback ok_cb; + char *button_text; + /* Get the first callback, skipping over the title */ + button_text = va_arg(actions, char *); + printf("Automatically pressing: %s\nin dialogue%s\n%s\n", button_text, primary, secondary); + ok_cb = va_arg(actions, GCallback); + ((PurpleRequestActionCb)ok_cb)(user_data, default_action); +} + +static gpointer ruburple_notify_message(PurpleNotifyMsgType type, const char *title, const char *primary, @@ -391,6 +410,20 @@ NULL, }; +static PurpleRequestUiOps request_ops = + { + NULL, + NULL, + ruburple_request_blindly_accept, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }; + + static gpointer run_the_loop(gpointer data) { @@ -411,6 +444,8 @@ purple_notify_set_ui_ops(¬ify_ops); + purple_request_set_ui_ops(&request_ops); + /* Now that all the essential stuff has been set, let's try to init the core. It's * necessary to provide a non-NULL name for the current ui to the core. This name * is used by stuff that depends on this ui, for example the ui-specific plugins. */