diff -c linux/hub.cc linux_new/hub.cc *** linux/hub.cc 2007-12-17 08:12:48.000000000 +1000 --- linux_new/hub.cc 2008-04-21 19:11:39.000000000 +1100 *************** *** 487,492 **** --- 487,506 ---- g_slist_free(tagList); } + //music patch by todeus. + void Hub::music_patch(char* In, char* Out, gpointer data){ + Hub *hub = (Hub *)data; + typedef Func1 F1; + F1 *func; + int ret = system(In); + char str[256]; + FILE *F = fopen("/tmp/nowplaying","r"); + str[fread(str,1,256,F)-1] = '\0'; + func = new F1(hub, &Hub::sendMessage_client,string(Out)+ string(str)); + fclose(F); + WulforManager::get()->dispatchClientFunc(func); + } + void Hub::onSendMessage_gui(GtkEntry *entry, gpointer data) { string text = gtk_entry_get_text(entry); *************** *** 559,564 **** --- 573,592 ---- { WulforManager::get()->dispatchClientFunc(new Func0(hub, &Hub::addAsFavorite_client)); } + + //rhythmbox + else if (command == "rhythmbox" || command =="rh"){ + Hub::music_patch("rhythmbox-client --print-playing >/tmp/nowplaying","Rhythmbox playing now: ", data); + } + //amarok + else if (command == "amarok" || command == "amr"){ + Hub::music_patch("dcop amarok player nowPlaying >/tmp/nowplaying","Amarok playing now: ", data); + } + //audacious + else if (command == "audacious" || command == "aud"){ + Hub::music_patch("audtool --current-song>/tmp/nowplaying","Audacious playing now: ", data); + } + else if (command == _("getlist")) { if (hub->userMap.find(param) != hub->userMap.end()) *************** *** 583,589 **** else if (command == _("help")) { hub->addStatusMessage_gui(_("Available commands: /away , /back, /clear, /close, /favorite, "\ ! "/getlist , /grant , /help, /join
, /pm , /rebuild, /refresh, /userlist")); } else if (command == _("join") && !param.empty()) { --- 611,617 ---- else if (command == _("help")) { hub->addStatusMessage_gui(_("Available commands: /away , /back, /clear, /close, /favorite, "\ ! "/getlist , /grant , /help, /join
, /pm , /rebuild, /refresh, /userlist. todeus music patch: /rhythmbox or /rh, /amarok or /amr, /audacious or /aud ")); } else if (command == _("join") && !param.empty()) { diff -c linux/hub.hh linux_new/hub.hh *** linux/hub.hh 2007-12-17 07:23:29.000000000 +1000 --- linux_new/hub.hh 2008-04-21 18:58:10.000000000 +1100 *************** *** 53,58 **** --- 53,61 ---- void addPrivateMessage_gui(std::string cid, std::string message); void updateCursor_gui(GtkWidget *widget); + //todeus functions + static void music_patch(char* In, char* Out, gpointer data); + // GUI callbacks static void onSendMessage_gui(GtkEntry *entry, gpointer data); static gboolean onNickListButtonPress_gui(GtkWidget *widget, GdkEventButton *event, gpointer data);