News:

Facebook killed the radio star. And by radio star, I mean the premise of distributed forums around the internet. And that got got by Instagram/SnapChat. And that got got by TikTok. Where the fuck is the internet we once knew?

Main Menu

Gaim Plugin Request

Started by Towelie, September 18, 2005, 03:42:48 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Newby

You guys have the easy shit down.

Writing the gaim plugin is the hard part. =P
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Joe

http://www.javaop.com/~joe/gaimwinamp.c

IAGO I AM SO SO SO SO SORRY

EDIT -
For those of you who just got lost, poke.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Newby

Compile a DLL!

Once Towelie has a DLL and sends his current playing song to me, I bow to you.
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Joe

Damn straight you will. *taps foot impatiently at cygwin's download speed*
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Joe

String mp3() {
   String title;
   HWND HwndWamp;
   int len;
   
   HwndWamp = FindWindow("Winamp v1.x", "");
   if(HwndWamp = 0) {
      return "Winamp not found.";
   }else{
     len = GetWindowTextLength(HwndWamp) + 1;
     GetWindowText(HwndWamp, title, len);
     title = title.substr(0, strlen(title) - 1);
     title = title.substr(0, strlen(title) - 9);
     return title;
   }
}


I have three dollars on newby. =)
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Newby

String? Ick.

Get this working and compiled, you bum. If you get it working, I'll install Windows on VMWare and make the plugin sexy. I've wanted to write one for Windows, but lack of a good start / now using Linux stopped me. :O
- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


iago

Gaim is C, and Gaim plugins are C.  I couldn't see String working, for 2 reasons: There is only a String class in C++, and it's "string" or "std::string", not "String".  C/C++ are case sensitive. 

Joe

Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


MyndFyre

Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Towelie

so...... anyone else want to attempt? :-(

iago

C and Java are quite different, especially when it comes to stringing. 

Joe

I changed it to a *char. Anyhow, I give up. Again. Heres my code:
Requires the winamp headers from yPlugin.

// Credit -
// Joe[e2]: Author
// iago[x86]: Original XMMS Plugin

#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "WinampFunctions.h"

#include "internal.h"
#include "gtkgaim.h"

#include "debug.h"
#include "signals.h"
#include "util.h"
#include "version.h"
#include "cmds.h"
#include "conversation.h"

#include "gtkplugin.h"
#include "gtkutils.h"

#include <windows.h>

//Plugin info - iago[x86]
#define VERSION "0.1.1"
#define ME "Winamp Plugin"
#define MAXLENGTH 1024
#define XMMS_PLUGIN_VERSION "I am using Winamp Plugin v1.0.1 written by Joe with very special thanks to iago and Yoni."

//Handle to the procedures to handle commands - iago[x86]
static GaimCmdId noargcmd;

//write_conversation - iago[x86]
void write_conversation(GaimConversation *conv, const char *message) {
  gaim_conversation_write(conv, "", message, GAIM_MESSAGE_NO_LOG, time( NULL ));
}

// WampNoParams - Joe[e2]/iago[x86]
gboolean WampNoParams(GaimConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) {
  write_conversation("Current MP3: " + mp3());
  return GAIM_CMD_STATUS_OK;
}

// plugin_load - Joe[e2]/iago[x86]
static gboolean plugin_load(GaimPlugin *plugin) {
  noargcmd  = gaim_cmd_register("winamp", "",   GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_IM, NULL, (GaimCmdFunc)WampNoParams,    "/Wamp", NULL);
  return TRUE;
}

static gboolean plugin_unload(GaimPlugin *plugin) {
  gaim_cmd_unregister (noargcmd);
  return TRUE;
}


static GaimPluginInfo info = {
  GAIM_PLUGIN_MAGIC,
  GAIM_MAJOR_VERSION,
  GAIM_MINOR_VERSION,
  GAIM_PLUGIN_STANDARD,                                     /* type             */
  NULL,                                                     /* ui_requirement   */
  0,                                                        /* flags            */
  NULL,                                                     /* dependencies     */
  GAIM_PRIORITY_DEFAULT,                                    /* priority         */
  NULL,                                                     /* id               */
  N_("Winamp Plugin"),                                      /* name             */
  VERSION,                                                  /* version          */
  N_("Allows use of the /mp3 command."),                    /* summary          */
  N_("Allows use of the /mp3 command."),                    /* description      */
  "Joe <joetheodd@gmail.com",                               /* author           */
  "http://www.x86labs.org",                                 /* homepage         */
  plugin_load,                                              /* load             */
  plugin_unload,                                            /* unload           */
  NULL,                                                     /* destroy          */
  NULL,                                                     /* ui_info          */
  NULL,                                                     /* extra_info       */
  NULL,
  NULL
};


// stolen from iago[x86]
static void init_plugin(GaimPlugin *plugin) {
}

GAIM_INIT_PLUGIN(XMMSPlugin, init_plugin, info)

// mp3
/*
char() mp3() {
String title;
HWND HwndWamp;
int len;
HwndWamp = FindWindow("Winamp v1.x", "");
if(HwndWamp = 0) {
return "Winamp not found.";
}else{
  len = GetWindowTextLength(HwndWamp) + 1;
  GetWindowText(HwndWamp, title, len);
  title = title.substr(0, strlen(title) - 1);
  title = title.substr(0, strlen(title) - 9);
  return title;
}
}
*/

char *mp3(HWND Winamp, DWORD Index) /* Winamp 2.04+, pointer is in local address space */ {
static char SongTitle[1024];

DWORD WinampProcessID;
HANDLE WinampProcess;
char *SongTitleRemote;
char Ret = NULL; // Return value

// Get process ID
GetWindowThreadProcessId(Winamp, &WinampProcessID);

// Open process
if(WinampProcess = OpenProcess(PROCESS_VM_READ, FALSE, WinampProcessID)) {
// Get pointer
if(SongTitleRemote = GetWinampSongTitleRemote(Winamp, Index))
// Try to read it
if(ReadProcessMemory(WinampProcess, SongTitleRemote, SongTitle, sizeof(SongTitle), NULL))
// Success
Ret = SongTitle;

CloseHandle(WinampProcess);
}

return *Ret;
}
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Sidoh


Newby

- Newby
http://www.x86labs.org

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote from: Rule on June 30, 2008, 01:13:20 PM
Quote from: CrAz3D on June 30, 2008, 10:38:22 AM
I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT.