view libpurple/protocols/silc/silcpurple.h @ 27243:7054f810b0f9

Check in code that connects to oscar using clientLogin. This is the authentication scheme they've publically documented. We still use the old MD5-style login as the default, but you can optionally try this out by checking a check box on the advanced tab of your oscar account. Functionally everything is supposed to be the same. However, for some reason users with Mobile IM forwarding turned on don't show up online and can't be messaged. Not sure why. Using clientLogin DOES make it easier for AOL to track us. And yes, it probably makes it easier for AOL to block us, too. But I don't believe they want to do that. I believe they're trying to keep their network open, and I think we should appreciate that and try to work with them. We're not just some small open source project that slips under the radar unnoticed anymore. It's good to have options, right? None of this code was taken from anywhere (outside of libpurple). I wrote it all from scratch (and took a few bits from other places in libpurple). I did use the documentation on http://dev.aol.com/aim , but I don't believe that affects us from a licensing standpoint in any way. If you disagree we should talk about it on the devel mailing list.
author Mark Doliner <mark@kingant.net>
date Tue, 23 Jun 2009 18:20:12 +0000
parents 6b02dba5bf41
children 1cdae196aac8
line wrap: on
line source

/*

  silcpurple.h

  Author: Pekka Riikonen <priikone@silcnet.org>

  Copyright (C) 2004 - 2007 Pekka Riikonen

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 2 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

*/

#ifndef SILCPURPLE_H
#define SILCPURPLE_H

/* Purple includes */
#include "internal.h"
#include "account.h"
#include "accountopt.h"
#include "cmds.h"
#include "conversation.h"
#include "debug.h"
#include "ft.h"
#include "notify.h"
#include "prpl.h"
#include "request.h"
#include "roomlist.h"
#include "server.h"
#include "util.h"

#undef SILC_VERSION
#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8))

/* Default public and private key file names */
#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub"
#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv"

/* Default settings for creating key pair */
#define SILCPURPLE_DEF_PKCS "rsa"
#define SILCPURPLE_DEF_PKCS_LEN 2048

#define SILCPURPLE_PRVGRP 0x001fffff

/* Status IDs */
#define SILCPURPLE_STATUS_ID_OFFLINE	"offline"
#define SILCPURPLE_STATUS_ID_AVAILABLE "available"
#define SILCPURPLE_STATUS_ID_HYPER	"hyper"
#define SILCPURPLE_STATUS_ID_AWAY		"away"
#define SILCPURPLE_STATUS_ID_BUSY		"busy"
#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed"
#define SILCPURPLE_STATUS_ID_PAGE		"page"

typedef struct {
	unsigned long id;
	const char *channel;
	unsigned long chid;
	const char *parentch;
	SilcChannelPrivateKey key;
} *SilcPurplePrvgrp;

/* The SILC Purple plugin context */
typedef struct SilcPurpleStruct {
	SilcClient client;
	SilcClientConnection conn;
	SilcPublicKey public_key;
	SilcPrivateKey private_key;
	SilcHash sha1hash;

	SilcDList tasks;
	guint scheduler;
	PurpleConnection *gc;
	PurpleAccount *account;
	unsigned long channel_ids;
	GList *grps;

	char *motd;
	PurpleRoomlist *roomlist;
	SilcMimeAssembler mimeass;
	unsigned int detaching            : 1;
	unsigned int resuming             : 1;
	unsigned int roomlist_canceled    : 1;
	unsigned int chpk                 : 1;
} *SilcPurple;


void silc_say(SilcClient client, SilcClientConnection conn,
	      SilcClientMessageType type, char *msg, ...);
SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn,
				  SilcCommand command, SilcStatus status,
				  SilcStatus error, void *context, va_list ap);
gboolean silcpurple_check_silc_dir(PurpleConnection *gc);
const char *silcpurple_silcdir(void);
const char *silcpurple_session_file(const char *account);
void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn,
				  const char *name,
				  SilcConnectionType conn_type,
				  SilcPublicKey public_key,
				  SilcVerifyPublicKey completion,
				  void *context);
GList *silcpurple_buddy_menu(PurpleBuddy *buddy);
void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
void silcpurple_send_buddylist(PurpleConnection *gc);
void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
void silcpurple_buddy_keyagr_request(SilcClient client,
				     SilcClientConnection conn,
				     SilcClientEntry client_entry,
				     const char *hostname, SilcUInt16 port,
				     SilcUInt16 protocol);
void silcpurple_idle_set(PurpleConnection *gc, int idle);
void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
char *silcpurple_status_text(PurpleBuddy *b);
gboolean silcpurple_ip_is_private(const char *ip);
void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file);
PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name);
void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn,
			  SilcClientEntry client_entry, SilcUInt32 session_id,
			  const char *hostname, SilcUInt16 port);
void silcpurple_show_public_key(SilcPurple sg,
			      const char *name, SilcPublicKey public_key,
			      GCallback callback, void *context);
void silcpurple_get_info(PurpleConnection *gc, const char *who);
SilcAttributePayload
silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute);
void silcpurple_get_umode_string(SilcUInt32 mode, char *buf,
			       SilcUInt32 buf_size);
void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf,
				SilcUInt32 buf_size);
void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf,
				 SilcUInt32 buf_size);
GList *silcpurple_chat_info(PurpleConnection *gc);
GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name);
GList *silcpurple_chat_menu(PurpleChat *);
void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data);
char *silcpurple_get_chat_name(GHashTable *data);
void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg,
			  const char *name);
void silcpurple_chat_leave(PurpleConnection *gc, int id);
int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags);
void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic);
PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc);
void silcpurple_roomlist_cancel(PurpleRoomlist *list);
void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel,
				 SilcDList channel_pubkeys);
void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr,
					 char **contactstr, char **langstr, char **devicestr,
					 char **tzstr, char **geostr);
void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img);
char *silcpurple_file2mime(const char *filename);
SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags);

#ifdef _WIN32
typedef int uid_t;

struct passwd {
	char	*pw_name;	/* user name */
	char	*pw_passwd;	/* user password */
	int		pw_uid;		/* user id */
	int		pw_gid;		/* group id */
	char	*pw_gecos;	/* real name */
	char	*pw_dir;	/* home directory */
	char	*pw_shell;	/* shell program */
};

struct passwd *getpwuid(int uid);
int getuid(void);
int geteuid(void);
#endif

#endif /* SILCPURPLE_H */