Author Topic: Gaim Plugin Request  (Read 21403 times)

0 Members and 2 Guests are viewing this topic.

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Gaim Plugin Request
« Reply #30 on: September 19, 2005, 07:22:21 pm »
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

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. 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #31 on: September 19, 2005, 07:49:13 pm »
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.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Gaim Plugin Request
« Reply #32 on: September 19, 2005, 07:52:05 pm »
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

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. 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #33 on: September 19, 2005, 07:53:25 pm »
Damn straight you will. *taps foot impatiently at cygwin's download speed*
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #34 on: September 19, 2005, 09:30:02 pm »
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. =)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Gaim Plugin Request
« Reply #35 on: September 19, 2005, 09:38:50 pm »
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

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. 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #36 on: September 19, 2005, 09:49:08 pm »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Gaim Plugin Request
« Reply #37 on: September 19, 2005, 09:52:01 pm »
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. 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #38 on: September 19, 2005, 10:31:59 pm »
I was going by Java. =)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: Gaim Plugin Request
« Reply #39 on: September 19, 2005, 10:54:07 pm »
I was going by Java. =)
...which was wrong.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Towelie

  • pwnstar
  • x86
  • Hero Member
  • *****
  • Posts: 4873
    • View Profile
Re: Gaim Plugin Request
« Reply #40 on: September 19, 2005, 11:22:25 pm »
so...... anyone else want to attempt? :-(

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: Gaim Plugin Request
« Reply #41 on: September 20, 2005, 12:05:17 am »
C and Java are quite different, especially when it comes to stringing. 

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: Gaim Plugin Request
« Reply #42 on: September 21, 2005, 05:17:58 pm »
I changed it to a *char. Anyhow, I give up. Again. Heres my code:
Requires the winamp headers from yPlugin.

Code: [Select]
// 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;
}
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: Gaim Plugin Request
« Reply #43 on: September 21, 2005, 05:26:58 pm »
Does it work? =P

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Gaim Plugin Request
« Reply #44 on: September 21, 2005, 05:28:15 pm »
Joe gave up. I knew it. :)
- 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

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.