changeset 5730:99ae9bd8b5fa

[gaim-migrate @ 6154] Added basic support for Trepia. Don't blame me if it doesn't work! It's a weird little system :) Use with caution in a fire-safe environment. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 04 Jun 2003 03:57:26 +0000
parents 61113d76091c
children 7cb2bbf03db5
files ChangeLog configure.ac pixmaps/status/default/Makefile.am pixmaps/status/default/female.png pixmaps/status/default/male.png pixmaps/status/default/trepia.png src/protocols/Makefile.am src/protocols/trepia/.cvsignore src/protocols/trepia/Makefile.am src/protocols/trepia/md5.h src/protocols/trepia/profile.c src/protocols/trepia/profile.h src/protocols/trepia/trepia.c src/prpl.h
diffstat 14 files changed, 1560 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 04 02:17:03 2003 +0000
+++ b/ChangeLog	Wed Jun 04 03:57:26 2003 +0000
@@ -4,6 +4,7 @@
 	* Massive internal core/ui splitting
 	* Russian translation updated (Dzmitry Chekmarou)
 	* New account dialog.
+	* Added Trepia support.
 
 version 0.64 (05/29/2003):
 	* Buddy list sorting in buddy list preferences.
--- a/configure.ac	Wed Jun 04 02:17:03 2003 +0000
+++ b/configure.ac	Wed Jun 04 03:57:26 2003 +0000
@@ -104,6 +104,7 @@
 		napster) static_napster=yes ;;
 		oscar) static_oscar=yes ;;
 		toc) static_toc=yes ;;
+		trepia) static_trepia=yes ;;
 		yahoo) static_yahoo=yes ;;
 		zephyr) static_zephyr=yes ;;
 		*) echo "Invalid static protocol $i!!" ; exit ;;
@@ -116,6 +117,7 @@
 AM_CONDITIONAL(STATIC_NAPSTER, test "x$static_napster" = "xyes")
 AM_CONDITIONAL(STATIC_OSCAR, test "x$static_oscar" = "xyes")
 AM_CONDITIONAL(STATIC_TOC, test "x$static_toc" = "xyes")
+AM_CONDITIONAL(STATIC_TREPIA, test "x$static_trepia" = "xyes")
 AM_CONDITIONAL(STATIC_YAHOO, test "x$static_yahoo" = "xyes")
 AM_CONDITIONAL(STATIC_ZEPHYR, test "x$static_zephyr" = "xyes")
 AC_SUBST(STATIC_LINK_LIBS)
@@ -426,6 +428,7 @@
 	   src/protocols/napster/Makefile
 	   src/protocols/oscar/Makefile
 	   src/protocols/toc/Makefile
+	   src/protocols/trepia/Makefile
 	   src/protocols/yahoo/Makefile
 	   src/protocols/zephyr/Makefile
 	   gaim.spec
--- a/pixmaps/status/default/Makefile.am	Wed Jun 04 02:17:03 2003 +0000
+++ b/pixmaps/status/default/Makefile.am	Wed Jun 04 03:57:26 2003 +0000
@@ -1,14 +1,9 @@
 EXTRA_DIST = activebuddy.png admin.png aim.png aol.png away.png dnd.png \
-			 extendedaway.png freeforchat.png gadu-gadu.png game.png icq.png \
-			 invisible.png irc.png jabber.png login.png logout.png msn.png \
-			 na.png napster.png notauthorized.png occupied.png offline.png \
-			 wireless.png yahoo.png
+			 extendedaway.png female.png freeforchat.png gadu-gadu.png \
+			 game.png icq.png invisible.png irc.png jabber.png login.png \
+			 logout.png male.png msn.png na.png napster.png notauthorized.png \
+			 occupied.png offline.png trepia.png wireless.png yahoo.png
 
 gaimstatuspixdir = $(datadir)/pixmaps/gaim/status/default
 
-gaimstatuspix_DATA = activebuddy.png admin.png aim.png aol.png away.png \
-					 dnd.png extendedaway.png freeforchat.png gadu-gadu.png \
-					 game.png icq.png invisible.png irc.png jabber.png \
-					 login.png logout.png msn.png na.png napster.png \
-					 notauthorized.png occupied.png offline.png \
-					 wireless.png yahoo.png
+gaimstatuspix_DATA = $(EXTRA_DIST)
Binary file pixmaps/status/default/female.png has changed
Binary file pixmaps/status/default/male.png has changed
Binary file pixmaps/status/default/trepia.png has changed
--- a/src/protocols/Makefile.am	Wed Jun 04 02:17:03 2003 +0000
+++ b/src/protocols/Makefile.am	Wed Jun 04 03:57:26 2003 +0000
@@ -1,4 +1,4 @@
-DIST_SUBDIRS = gg irc jabber msn napster oscar toc yahoo zephyr
+DIST_SUBDIRS = gg irc jabber msn napster oscar toc trepia yahoo zephyr
 
 if PRPLS
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/.cvsignore	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,12 @@
+Makefile.in
+Makefile
+.deps
+.libs
+*.lo
+*.la
+*.dll
+*.def
+*.lib
+.*.swp
+.*.swo
+.todo.*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/Makefile.am	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,30 @@
+pkgdir = $(libdir)/gaim
+
+TREPIASOURCES = \
+	md5.h \
+	profile.c \
+	profile.h \
+	trepia.c
+
+AM_CFLAGS = $(st)
+
+libtrepia_la_LDFLAGS = -module -avoid-version
+
+if STATIC_TREPIA
+
+st = -DSTATIC
+noinst_LIBRARIES = libtrepia.a
+libtrepia_a_SOURCES = $(TREPIASOURCES)
+libtrepia_a_CFLAGS  = $(AM_CFLAGS)
+
+else
+
+st =
+pkg_LTLIBRARIES   = libtrepia.la
+libtrepia_la_SOURCES = $(TREPIASOURCES)
+
+endif
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/src \
+	$(DEBUG_CFLAGS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/md5.h	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,93 @@
+/*
+  Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  L. Peter Deutsch
+  ghost@aladdin.com
+
+ */
+/*
+  Independent implementation of MD5 (RFC 1321).
+
+  This code implements the MD5 Algorithm defined in RFC 1321.
+  It is derived directly from the text of the RFC and not from the
+  reference implementation.
+
+  The original and principal author of md5.h is L. Peter Deutsch
+  <ghost@aladdin.com>.  Other authors are noted in the change history
+  that follows (in reverse chronological order):
+
+  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
+	added conditionalization for C++ compilation from Martin
+	Purschke <purschke@bnl.gov>.
+  1999-05-03 lpd Original version.
+ */
+
+#ifndef md5_INCLUDED
+#  define md5_INCLUDED
+
+/*
+ * This code has some adaptations for the Ghostscript environment, but it
+ * will compile and run correctly in any environment with 8-bit chars and
+ * 32-bit ints.  Specifically, it assumes that if the following are
+ * defined, they have the same meaning as in Ghostscript: P1, P2, P3,
+ * ARCH_IS_BIG_ENDIAN.
+ */
+
+typedef unsigned char md5_byte_t; /* 8-bit byte */
+typedef unsigned int md5_word_t; /* 32-bit word */
+
+/* Define the state of the MD5 Algorithm. */
+typedef struct md5_state_s {
+    md5_word_t count[2];	/* message length in bits, lsw first */
+    md5_word_t abcd[4];		/* digest buffer */
+    md5_byte_t buf[64];		/* accumulate block */
+} md5_state_t;
+
+#ifdef __cplusplus
+extern "C" 
+{
+#endif
+
+/* Initialize the algorithm. */
+#ifdef P1
+void md5_init(P1(md5_state_t *pms));
+#else
+void md5_init(md5_state_t *pms);
+#endif
+
+/* Append a string to the message. */
+#ifdef P3
+void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes));
+#else
+void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
+#endif
+
+/* Finish the message and return the digest. */
+#ifdef P2
+void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16]));
+#else
+void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
+#endif
+
+#ifdef __cplusplus
+}  /* end extern "C" */
+#endif
+
+#endif /* md5_INCLUDED */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/profile.c	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,435 @@
+/**
+ * @file profile.h Trepia profile API
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "profile.h"
+
+TrepiaProfile *
+trepia_profile_new(void)
+{
+	return g_new0(TrepiaProfile, 1);
+}
+
+void
+trepia_profile_destroy(TrepiaProfile *profile)
+{
+	if (profile->location   != NULL) g_free(profile->location);
+	if (profile->login      != NULL) g_free(profile->login);
+	if (profile->first_name != NULL) g_free(profile->first_name);
+	if (profile->last_name  != NULL) g_free(profile->last_name);
+	if (profile->profile    != NULL) g_free(profile->profile);
+	if (profile->email      != NULL) g_free(profile->email);
+	if (profile->aim        != NULL) g_free(profile->aim);
+	if (profile->homepage   != NULL) g_free(profile->homepage);
+	if (profile->country    != NULL) g_free(profile->country);
+	if (profile->state      != NULL) g_free(profile->state);
+	if (profile->city       != NULL) g_free(profile->city);
+	if (profile->languages  != NULL) g_free(profile->languages);
+	if (profile->school     != NULL) g_free(profile->school);
+	if (profile->company    != NULL) g_free(profile->company);
+
+	g_free(profile);
+}
+
+void
+trepia_profile_set_id(TrepiaProfile *profile, int value)
+{
+	g_return_if_fail(profile != NULL);
+
+	profile->id = value;
+}
+
+void
+trepia_profile_set_location(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->location != NULL)
+		g_free(profile->location);
+
+	profile->location = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_login_time(TrepiaProfile *profile, time_t value)
+{
+	g_return_if_fail(profile != NULL);
+
+	profile->login_time = value;
+}
+
+void
+trepia_profile_set_login(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->login != NULL)
+		g_free(profile->login);
+
+	profile->login = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_age(TrepiaProfile *profile, int value)
+{
+	g_return_if_fail(profile != NULL);
+
+	profile->age = value;
+}
+
+
+void
+trepia_profile_set_sex(TrepiaProfile *profile, char value)
+{
+	g_return_if_fail(profile != NULL);
+
+	profile->sex = value;
+}
+
+void
+trepia_profile_set_first_name(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->first_name != NULL)
+		g_free(profile->first_name);
+
+	profile->first_name = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_last_name(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->last_name != NULL)
+		g_free(profile->last_name);
+
+	profile->last_name = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_profile(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->profile != NULL)
+		g_free(profile->profile);
+
+	profile->profile = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_email(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->email != NULL)
+		g_free(profile->email);
+
+	profile->email = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_icq(TrepiaProfile *profile, int value)
+{
+	g_return_if_fail(profile != NULL);
+
+	profile->icq = value;
+}
+
+void
+trepia_profile_set_aim(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->aim != NULL)
+		g_free(profile->aim);
+
+	profile->aim = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_msn(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->msn != NULL)
+		g_free(profile->msn);
+
+	profile->msn = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_yahoo(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->yahoo != NULL)
+		g_free(profile->yahoo);
+
+	profile->yahoo = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_homepage(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->homepage != NULL)
+		g_free(profile->homepage);
+
+	profile->homepage = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_country(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->country != NULL)
+		g_free(profile->country);
+
+	profile->country = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_state(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->state != NULL)
+		g_free(profile->state);
+
+	profile->state = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_city(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->city != NULL)
+		g_free(profile->city);
+
+	profile->city = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_languages(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->languages != NULL)
+		g_free(profile->languages);
+
+	profile->languages = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_school(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->school != NULL)
+		g_free(profile->school);
+
+	profile->school = (value == NULL ? NULL : g_strdup(value));
+}
+
+void
+trepia_profile_set_company(TrepiaProfile *profile, const char *value)
+{
+	g_return_if_fail(profile != NULL);
+
+	if (profile->company != NULL)
+		g_free(profile->company);
+
+	profile->company = (value == NULL ? NULL : g_strdup(value));
+}
+
+int
+trepia_profile_get_id(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, 0);
+
+	return profile->id;
+}
+
+const char *
+trepia_profile_get_location(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->location;
+}
+
+time_t
+trepia_profile_get_login_time(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, 0);
+
+	return profile->login_time;
+}
+
+const char *
+trepia_profile_get_login(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->login;
+}
+
+int
+trepia_profile_get_age(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, 0);
+
+	return profile->age;
+}
+
+char
+trepia_profile_get_sex(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, '?');
+
+	return profile->sex;
+}
+
+const char *
+trepia_profile_get_first_name(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->first_name;
+}
+
+const char *
+trepia_profile_get_last_name(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->last_name;
+}
+
+const char *
+trepia_profile_get_profile(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->profile;
+}
+
+const char *
+trepia_profile_get_email(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->email;
+}
+
+int
+trepia_profile_get_icq(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, 0);
+
+	return profile->icq;
+}
+
+const char *
+trepia_profile_get_aim(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->aim;
+}
+
+const char *
+trepia_profile_get_msn(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->msn;
+}
+
+const char *
+trepia_profile_get_yahoo(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->yahoo;
+}
+
+const char *
+trepia_profile_get_homepage(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->homepage;
+}
+
+const char *
+trepia_profile_get_country(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->country;
+}
+
+const char *
+trepia_profile_get_state(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->state;
+}
+
+const char *
+trepia_profile_get_city(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->city;
+}
+
+const char *
+trepia_profile_get_languages(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->languages;
+}
+
+const char *
+trepia_profile_get_school(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->school;
+}
+
+const char *
+trepia_profile_get_company(const TrepiaProfile *profile)
+{
+	g_return_val_if_fail(profile != NULL, NULL);
+
+	return profile->company;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/profile.h	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,101 @@
+/**
+ * @file profile.h Trepia profile API
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _TREPIA_PROFILE_H_
+#define _TREPIA_PROFILE_H_
+
+#include <glib.h>
+#include <time.h>
+
+typedef struct
+{
+	int id;             /* a */
+	char *location;     /* p */
+	time_t login_time;  /* b */
+	char *login;        /* d */
+	int age;            /* m */
+	char sex;           /* n */
+	char *first_name;   /* g */
+	char *last_name;    /* h */
+	char *profile;      /* o */
+	char *email;        /* e */
+	int   icq;          /* i */
+	char *aim;          /* j */
+	char *msn;          /* k */
+	char *yahoo;        /* l */
+	char *homepage;     /* f */
+	char *country;      /* r */
+	char *state;        /* s */
+	char *city;         /* t */
+	char *languages;    /* u */
+	char *school;       /* v */
+	char *company;      /* w */
+
+} TrepiaProfile;
+
+TrepiaProfile *trepia_profile_new(void);
+void trepia_profile_destroy(TrepiaProfile *profile);
+
+void trepia_profile_set_id(TrepiaProfile *profile, int value);
+void trepia_profile_set_location(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_login_time(TrepiaProfile *profile, time_t value);
+void trepia_profile_set_login(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_age(TrepiaProfile *profile, int value);
+void trepia_profile_set_sex(TrepiaProfile *profile, char value);
+void trepia_profile_set_first_name(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_last_name(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_profile(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_email(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_icq(TrepiaProfile *profile, int value);
+void trepia_profile_set_aim(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_msn(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_yahoo(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_homepage(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_country(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_state(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_city(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_languages(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_school(TrepiaProfile *profile, const char *value);
+void trepia_profile_set_company(TrepiaProfile *profile, const char *value);
+
+int trepia_profile_get_id(const TrepiaProfile *profile);
+const char *trepia_profile_get_location(const TrepiaProfile *profile);
+time_t trepia_profile_get_login_time(const TrepiaProfile *profile);
+const char *trepia_profile_get_login(const TrepiaProfile *profile);
+int trepia_profile_get_age(const TrepiaProfile *profile);
+char trepia_profile_get_sex(const TrepiaProfile *profile);
+const char *trepia_profile_get_first_name(const TrepiaProfile *profile);
+const char *trepia_profile_get_last_name(const TrepiaProfile *profile);
+const char *trepia_profile_get_profile(const TrepiaProfile *profile);
+const char *trepia_profile_get_email(const TrepiaProfile *profile);
+int trepia_profile_get_icq(const TrepiaProfile *profile);
+const char *trepia_profile_get_aim(const TrepiaProfile *profile);
+const char *trepia_profile_get_msn(const TrepiaProfile *profile);
+const char *trepia_profile_get_yahoo(const TrepiaProfile *profile);
+const char *trepia_profile_get_homepage(const TrepiaProfile *profile);
+const char *trepia_profile_get_country(const TrepiaProfile *profile);
+const char *trepia_profile_get_state(const TrepiaProfile *profile);
+const char *trepia_profile_get_city(const TrepiaProfile *profile);
+const char *trepia_profile_get_languages(const TrepiaProfile *profile);
+const char *trepia_profile_get_school(const TrepiaProfile *profile);
+const char *trepia_profile_get_company(const TrepiaProfile *profile);
+
+#endif /* _TREPIA_PROFILE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/protocols/trepia/trepia.c	Wed Jun 04 03:57:26 2003 +0000
@@ -0,0 +1,877 @@
+/**
+ * @file trepia.c The Trepia protocol plugin
+ *
+ * gaim
+ *
+ * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
+ * 
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "gaim.h"
+#include "account.h"
+#include "accountopt.h"
+#include "md5.h"
+#include "profile.h"
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifndef _WIN32
+# include <sys/socket.h>
+# include <sys/ioctl.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <net/if_arp.h>
+#endif
+
+static GaimPlugin *my_protocol = NULL;
+
+typedef enum
+{
+	TREPIA_LOGIN          = 'C',
+	TREPIA_PROFILE_REQ    = 'D',
+	TREPIA_MSG_OUTGOING   = 'F',
+	TREPIA_REGISTER       = 'J',
+	TREPIA_USER_LIST      = 'L',
+	TREPIA_MEMBER_UPDATE  = 'M',
+	TREPIA_MEMBER_OFFLINE = 'N',
+	TREPIA_MEMBER_PROFILE = 'O',
+	TREPIA_MSG_INCOMING   = 'Q'
+
+} TrepiaMessageType;
+
+typedef struct
+{
+	GaimConnection *gc;
+
+	int inpa;
+	int fd;
+
+	GString *rxqueue;
+
+} TrepiaSession;
+
+typedef struct
+{
+	TrepiaMessageType *type;
+	char *tag;
+
+	GHashTable *keys;
+
+	GString *buffer;
+
+} TrepiaParserData;
+
+#define TREPIA_SERVER    "trepia.com"
+#define TREPIA_PORT       8201
+#define TREPIA_REG_PORT   8209
+
+static int
+trepia_write(int fd, const char *data, size_t len)
+{
+	gaim_debug(GAIM_DEBUG_MISC, "trepia", "C: %s%c", data,
+			   (data[strlen(data) - 1] == '\n' ? '\0' : '\n'));
+
+	return write(fd, data, len);
+}
+
+static void
+__clear_user_list(GaimAccount *account)
+{
+	struct gaim_buddy_list *blist;
+	GaimBlistNode *group, *buddy, *next_buddy;
+
+	blist = gaim_get_blist();
+
+	for (group = blist->root; group != NULL; group = group->next) {
+		for (buddy = group->child; buddy != NULL; buddy = next_buddy) {
+			struct buddy *b = (struct buddy *)buddy;
+
+			next_buddy = buddy->next;
+
+			if (b->account == account)
+				gaim_blist_remove_buddy(b);
+		}
+	}
+}
+
+static char *
+__get_mac_address(const char *ip)
+{
+	char *mac = NULL;
+#ifndef _WIN32
+	struct sockaddr_in sin = { 0 };
+	struct arpreq myarp = { { 0 } };
+	int sockfd;
+	unsigned char *ptr;
+
+	sin.sin_family = AF_INET;
+
+	if (inet_aton(ip, &sin.sin_addr) == 0) {
+		gaim_debug(GAIM_DEBUG_ERROR, "trepia", "Invalid IP address %s\n", ip);
+		return NULL;
+	}
+
+	memcpy(&myarp.arp_pa, &sin, sizeof(myarp.arp_pa));
+	strcpy(myarp.arp_dev, "eth0");
+
+	if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
+		gaim_debug(GAIM_DEBUG_ERROR, "trepia",
+				   "Cannot open socket for retrieving MAC address.\n");
+		return NULL;
+	}
+
+	if (ioctl(sockfd, SIOCGARP, &myarp) == -1) {
+		gaim_debug(GAIM_DEBUG_ERROR, "trepia",
+				   "No entry in in arp_cache for %s\n", ip);
+		return NULL;
+	}
+
+	ptr = &myarp.arp_ha.sa_data[0];
+
+	mac = g_strdup_printf("%x:%x:%x:%x:%x:%x",
+						  ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]);
+#else
+#endif
+
+	return mac;
+}
+
+/**************************************************************************
+ * Protocol Plugin ops
+ **************************************************************************/
+
+static const char *
+trepia_list_icon(GaimAccount *a, struct buddy *b)
+{
+	return "trepia";
+}
+
+static void
+trepia_list_emblems(struct buddy *b, char **se, char **sw,
+				 char **nw, char **ne)
+{
+	TrepiaProfile *profile = (TrepiaProfile *)b->proto_data;
+
+	if (trepia_profile_get_sex(profile) == 'M')
+		*sw = "male";
+	else if (trepia_profile_get_sex(profile))
+		*sw = "female";
+}
+
+static char *
+trepia_status_text(struct buddy *b)
+{
+	return NULL;
+}
+
+static char *
+trepia_tooltip_text(struct buddy *b)
+{
+	return NULL;
+}
+
+static GList *
+trepia_away_states(GaimConnection *gc)
+{
+	GList *m = NULL;
+
+	return m;
+}
+
+static GList *
+trepia_actions(GaimConnection *gc)
+{
+	return NULL;
+}
+
+static GList *
+trepia_buddy_menu(GaimConnection *gc, const char *who)
+{
+	return NULL;
+}
+
+static void
+__free_parser_data(gpointer user_data)
+{
+	return;
+
+	TrepiaParserData *data = user_data;
+
+	if (data->buffer != NULL)
+		g_string_free(data->buffer, TRUE);
+
+	if (data->tag != NULL)
+		g_free(data->tag);
+
+	g_free(data);
+}
+
+static void
+__start_element_handler(GMarkupParseContext *context,
+						const gchar *element_name,
+						const gchar **attribute_names,
+						const gchar **attribute_values,
+						gpointer user_data, GError **error)
+{
+	TrepiaParserData *data = user_data;
+
+	if (data->buffer != NULL) {
+		g_string_free(data->buffer, TRUE);
+		data->buffer = NULL;
+	}
+
+	if (*data->type == 0) {
+		*data->type = *element_name;
+	}
+	else {
+		data->tag = g_strdup(element_name);
+	}
+}
+
+static void
+__end_element_handler(GMarkupParseContext *context, const gchar *element_name,
+					  gpointer user_data,  GError **error)
+{
+	TrepiaParserData *data = user_data;
+	gchar *buffer;
+
+	if (*element_name == *data->type)
+		return;
+
+	if (data->buffer == NULL || data->tag == NULL) {
+		data->tag = NULL;
+		return;
+	}
+
+	buffer = g_string_free(data->buffer, FALSE);
+	data->buffer = NULL;
+
+	g_hash_table_insert(data->keys, data->tag, buffer);
+
+	data->tag = NULL;
+}
+
+static void
+__text_handler(GMarkupParseContext *context, const gchar *text,
+			   gsize text_len, gpointer user_data, GError **error)
+{
+	TrepiaParserData *data = user_data;
+
+	if (data->buffer == NULL)
+		data->buffer = g_string_new_len(text, text_len);
+	else
+		g_string_append_len(data->buffer, text, text_len);
+}
+
+static GMarkupParser accounts_parser =
+{
+	__start_element_handler,
+	__end_element_handler,
+	__text_handler,
+	NULL,
+	NULL
+};
+
+static int
+__parse_message(const char *buf, TrepiaMessageType *type, GHashTable **info)
+{
+	TrepiaParserData *parser_data = g_new0(TrepiaParserData, 1);
+	GMarkupParseContext *context;
+	GHashTable *keys;
+
+	keys = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+	parser_data->keys = keys;
+	parser_data->type = type;
+
+	context = g_markup_parse_context_new(&accounts_parser, 0,
+										 parser_data, __free_parser_data);
+
+	if (!g_markup_parse_context_parse(context, buf, strlen(buf), NULL)) {
+		g_markup_parse_context_free(context);
+		g_free(parser_data);
+		g_hash_table_destroy(keys);
+
+		return 1;
+	}
+
+	if (!g_markup_parse_context_end_parse(context, NULL)) {
+		g_markup_parse_context_free(context);
+		g_free(parser_data);
+		g_hash_table_destroy(keys);
+
+		return 1;
+	}
+
+	g_markup_parse_context_free(context);
+
+	*info = keys;
+
+	return 0;
+}
+
+static gboolean
+__parse_data(TrepiaSession *session, char *buf)
+{
+	GHashTable *info;
+	GaimAccount *account;
+	TrepiaMessageType type = 0;
+	TrepiaProfile *profile;
+	int ret;
+	char *buffer;
+	struct buddy *b;
+	const char *id = NULL;
+	const char *value;
+
+	account = gaim_connection_get_account(session->gc);
+
+	ret = __parse_message(buf, &type, &info);
+
+	if (ret == 1)
+		return TRUE;
+
+	gaim_debug(GAIM_DEBUG_INFO, "trepia", "Successful parse.\n");
+	gaim_debug(GAIM_DEBUG_INFO, "trepia", "Message type: %c\n",
+			   type);
+
+	if (info != NULL) {
+		switch (type) {
+			case TREPIA_USER_LIST:
+				gaim_debug(GAIM_DEBUG_INFO, "trepia",
+						   "Signon complete. Showing buddy list.\n");
+				gaim_connection_set_state(session->gc, GAIM_CONNECTED);
+				serv_finish_login(session->gc);
+				break;
+
+			case TREPIA_MSG_INCOMING: /* Incoming Message */
+				gaim_debug(GAIM_DEBUG_INFO, "trepia", "Receiving message\n");
+				serv_got_im(session->gc,
+						(char *)g_hash_table_lookup(info, "a"),
+						(char *)g_hash_table_lookup(info, "b"),
+						0, time(NULL), -1);
+				break;
+
+			case TREPIA_MEMBER_UPDATE:
+				id  = g_hash_table_lookup(info, "a");
+				b = gaim_find_buddy(account, id);
+
+				if (b == NULL) {
+					struct group *g;
+
+					g = gaim_find_group(_("Local Users"));
+
+					if (g == NULL) {
+						g = gaim_group_new(_("Local Users"));
+						gaim_blist_add_group(g, NULL);
+					}
+
+					b = gaim_buddy_new(account, id, NULL);
+
+					gaim_blist_add_buddy(b, g, NULL);
+				}
+
+				b->proto_data = trepia_profile_new();
+
+				serv_got_update(session->gc, id, 1, 0, 0, 0, 0);
+
+				buffer = g_strdup_printf(
+					"<D>\n"
+					"<a>%s</a>\n"
+					"<b>1</b>\n"
+					"</D>",
+					id);
+
+				if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) {
+					gaim_connection_error(session->gc, _("Write error"));
+					g_free(buffer);
+					return 1;
+				}
+
+				buffer = g_strdup_printf(
+					"<D>\n"
+					"<a>%s</a>\n"
+					"<b>2</b>\n"
+					"</D>",
+					id);
+
+				if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) {
+					gaim_connection_error(session->gc, _("Write error"));
+					g_free(buffer);
+					return 1;
+				}
+
+				g_free(buffer);
+				break;
+
+			case TREPIA_MEMBER_PROFILE:
+				id = g_hash_table_lookup(info, "a");
+				b = gaim_find_buddy(account, id);
+
+				if (b == NULL)
+					break;
+
+				profile = b->proto_data;
+
+				/* ID */
+				trepia_profile_set_id(profile, atoi(id));
+
+				/* Login Time */
+				if ((value = g_hash_table_lookup(info, "b")) != NULL)
+					trepia_profile_set_login_time(profile, atoi(value));
+
+				/* Age */
+				if ((value = g_hash_table_lookup(info, "m")) != NULL)
+					trepia_profile_set_age(profile, atoi(value));
+
+				/* ICQ */
+				if ((value = g_hash_table_lookup(info, "i")) != NULL)
+					trepia_profile_set_icq(profile, atoi(value));
+
+				/* Sex */
+				if ((value = g_hash_table_lookup(info, "n")) != NULL)
+					trepia_profile_set_sex(profile, *value);
+
+				/* Location */
+				trepia_profile_set_location(profile,
+						g_hash_table_lookup(info, "p"));
+
+				/* First Name */
+				trepia_profile_set_first_name(profile,
+						g_hash_table_lookup(info, "g"));
+
+				/* Last Name */
+				trepia_profile_set_last_name(profile,
+						g_hash_table_lookup(info, "h"));
+
+				/* Profile */
+				trepia_profile_set_profile(profile,
+						g_hash_table_lookup(info, "o"));
+
+				/* E-mail */
+				trepia_profile_set_email(profile,
+						g_hash_table_lookup(info, "e"));
+
+				/* AIM */
+				trepia_profile_set_aim(profile,
+						g_hash_table_lookup(info, "j"));
+
+				/* MSN */
+				trepia_profile_set_msn(profile,
+						g_hash_table_lookup(info, "k"));
+
+				/* Yahoo */
+				trepia_profile_set_yahoo(profile,
+						g_hash_table_lookup(info, "l"));
+
+				/* Homepage */
+				trepia_profile_set_homepage(profile,
+						g_hash_table_lookup(info, "f"));
+
+				/* Country */
+				trepia_profile_set_country(profile,
+						g_hash_table_lookup(info, "r"));
+
+				/* State */
+				trepia_profile_set_state(profile,
+						g_hash_table_lookup(info, "s"));
+
+				/* City */
+				trepia_profile_set_city(profile,
+						g_hash_table_lookup(info, "t"));
+
+				/* Languages */
+				trepia_profile_set_languages(profile,
+						g_hash_table_lookup(info, "u"));
+
+				/* School */
+				trepia_profile_set_school(profile,
+						g_hash_table_lookup(info, "v"));
+
+				/* Company */
+				trepia_profile_set_company(profile,
+						g_hash_table_lookup(info, "w"));
+
+				/* Login Name */
+				if ((value = g_hash_table_lookup(info, "d")) != NULL) {
+					serv_got_alias(session->gc, id, value);
+					trepia_profile_set_location(profile, value);
+				}
+
+				/* Buddy Icon */
+				if ((value = g_hash_table_lookup(info, "q")) != NULL) {
+					char *icon;
+					int icon_len;
+
+					frombase64(value, &icon, &icon_len);
+
+					set_icon_data(session->gc, id, icon, icon_len);
+
+					g_free(icon);
+				}
+				break;
+
+			case TREPIA_MEMBER_OFFLINE:
+				id = g_hash_table_lookup(info, "a");
+
+				b = gaim_find_buddy(account, id);
+
+				if (b != NULL)
+					serv_got_update(session->gc, id, 0, 0, 0, 0, 0);
+
+				gaim_blist_remove_buddy(b);
+
+				break;
+
+			default:
+				break;
+		}
+
+		g_hash_table_destroy(info);
+	}
+	else {
+		gaim_debug(GAIM_DEBUG_WARNING, "trepia",
+				   "Unknown data received. Possibly an image?\n");
+	}
+
+	return TRUE;
+}
+
+static void
+__data_cb(gpointer data, gint source, GaimInputCondition cond)
+{
+	TrepiaSession *session = data;
+	int i = 0;
+	char buf[1025];
+	gboolean cont = TRUE;
+
+	i = read(session->fd, buf, 1024);
+
+	if (i <= 0) {
+		gaim_connection_error(session->gc, _("Read error"));
+		return;
+	}
+
+	buf[i] = '\0';
+
+	gaim_debug(GAIM_DEBUG_MISC, "trepia", "__data_cb\n");
+
+	if (session->rxqueue == NULL)
+		session->rxqueue = g_string_new(buf);
+	else
+		g_string_append(session->rxqueue, buf);
+
+	while (cont) {
+		char end_tag[5] = "</ >";
+		char *end_s;
+
+		end_tag[2] = session->rxqueue->str[1];
+
+		end_s = strstr(session->rxqueue->str, end_tag);
+
+		if (end_s != NULL) {
+			char *buffer;
+			size_t len;
+			int ret;
+
+			end_s += 4;
+
+			len = end_s - session->rxqueue->str;
+			buffer = g_new0(char, len + 1);
+			strncpy(buffer, session->rxqueue->str, len);
+
+			g_string_erase(session->rxqueue, 0, len);
+
+			if (*session->rxqueue->str == '\n')
+				g_string_erase(session->rxqueue, 0, 1);
+
+			gaim_debug(GAIM_DEBUG_MISC, "trepia", "S: %s\n", buffer);
+
+			ret = __parse_data(session, buffer);
+
+			g_free(buffer);
+		}
+		else
+			break;
+	}
+}
+
+static void
+__login_cb(gpointer data, gint source, GaimInputCondition cond)
+{
+	TrepiaSession *session = data;
+	GaimAccount *account;
+	const char *password;
+	char *buffer;
+	char *mac = "00:04:5A:50:31:DE";
+	char *gateway_mac = "00:C0:F0:52:D0:A6";
+	char buf[3];
+	char md5_password[17];
+	md5_state_t st;
+	md5_byte_t di[16];
+	int i;
+
+#if 0
+	mac = __get_mac_address();
+	gateway_mac = mac;
+#endif
+
+	mac = g_strdup("01:02:03:04:05:06");
+
+	gaim_debug(GAIM_DEBUG_INFO, "trepia", "__login_cb\n");
+
+	if (source < 0) {
+		gaim_debug(GAIM_DEBUG_ERROR, "trepia", "Write error.\n");
+		gaim_connection_error(session->gc, _("Write error"));
+		return;
+	}
+
+	gaim_debug(GAIM_DEBUG_ERROR, "trepia", "Past the first stage.\n");
+
+	session->fd = source;
+
+	account = gaim_connection_get_account(session->gc);
+
+	password = gaim_account_get_password(account);
+
+	md5_init(&st);
+	md5_append(&st, (const md5_byte_t *)password, strlen(password));
+	md5_finish(&st, di);
+
+	*md5_password = '\0';
+
+	for (i = 0; i < 16; i++) {
+		g_snprintf(buf, sizeof(buf), "%02x", di[i]);
+		strcat(md5_password, buf);
+	}
+
+	buffer = g_strdup_printf(
+		"<C>\n"
+		"<a>%s</a>\n"
+		"<b1>%s</b1>\n"
+		"<c>%s</c>\n"
+		"<d>%s</d>\n"
+		"<e>2.0</e>\n"
+		"</C>",
+		mac, gateway_mac, gaim_account_get_username(account),
+		md5_password);
+
+	g_free(mac);
+
+	if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) {
+		gaim_connection_error(session->gc, _("Write error"));
+		return;
+	}
+
+	g_free(buffer);
+
+	session->gc->inpa = gaim_input_add(session->fd, GAIM_INPUT_READ,
+									   __data_cb, session);
+}
+
+static void
+trepia_login(GaimAccount *account)
+{
+	GaimConnection *gc;
+	TrepiaSession *session;
+	const char *server;
+	int port;
+	int i;
+
+	gaim_debug(GAIM_DEBUG_INFO, "trepia", "trepia_login\n");
+
+	server = gaim_account_get_string(account, "server", TREPIA_SERVER);
+	port   = gaim_account_get_int(account,    "port",   TREPIA_PORT);
+
+	gc = gaim_account_get_connection(account);
+
+	session = g_new0(TrepiaSession, 1);
+	gc->proto_data = session;
+	session->gc = gc;
+	session->fd = -1;
+
+	__clear_user_list(account);
+
+	gaim_debug(GAIM_DEBUG_INFO, "trepia", "connecting to proxy\n");
+
+	i = gaim_proxy_connect(account, server, port, __login_cb, session);
+
+	if (i != 0)
+		gaim_connection_error(gc, _("Unable to create socket"));
+}
+
+static void
+trepia_close(GaimConnection *gc)
+{
+	__clear_user_list(gaim_connection_get_account(gc));
+
+	gc->proto_data = NULL;
+}
+
+static int
+trepia_send_im(GaimConnection *gc, const char *who, const char *message,
+			int len, int flags)
+{
+	TrepiaSession *session = gc->proto_data;
+	char *buffer;
+
+	buffer = g_strdup_printf(
+		"<F>\n"
+		"<a>%s</a>\n"
+		"<b>%s</b>\n"
+		"</F>",
+		who, message);
+
+	if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) {
+		gaim_connection_error(gc, _("Write error"));
+		g_free(buffer);
+		return 1;
+	}
+
+	return 1;
+}
+
+static void
+trepia_add_buddy(GaimConnection *gc, const char *name)
+{
+}
+
+static void
+trepia_rem_buddy(GaimConnection *gc, char *who, char *group)
+{
+}
+
+static void
+trepia_buddy_free(struct buddy *b)
+{
+	if (b->proto_data != NULL) {
+		trepia_profile_destroy(b->proto_data);
+
+		b->proto_data = NULL;
+	}
+}
+
+static void
+trepia_register_user(GaimAccount *account)
+{
+#if 0
+	char *buffer;
+
+	buffer = g_strdup_printf(
+		"<J><a>%s</a><b1>%s</b1><c>2.0</c><d>%s</d><e>%s</e>"
+		"<f>%s</f><g></g><h></h><i></i><j></j><k></k><l></l>"
+		"<m></m></J>");
+
+#endif
+}
+
+static GaimPluginProtocolInfo prpl_info =
+{
+	GAIM_PROTO_TREPIA,
+	OPT_PROTO_BUDDY_ICON,
+	NULL,
+	NULL,
+	trepia_list_icon,
+	trepia_list_emblems,
+	NULL,
+	trepia_tooltip_text,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	trepia_login,
+	trepia_close,
+	trepia_send_im,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	trepia_add_buddy,
+	NULL,
+	trepia_rem_buddy,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	trepia_register_user,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	trepia_buddy_free,
+	NULL,
+	NULL
+};
+
+static GaimPluginInfo info =
+{
+	2,                                                /**< api_version    */
+	GAIM_PLUGIN_PROTOCOL,                             /**< type           */
+	NULL,                                             /**< ui_requirement */
+	0,                                                /**< flags          */
+	NULL,                                             /**< dependencies   */
+	GAIM_PRIORITY_DEFAULT,                            /**< priority       */
+
+	"prpl-trepia",                                    /**< id             */
+	"Trepia",                                         /**< name           */
+	VERSION,                                          /**< version        */
+	                                                  /**  summary        */
+	N_("Trepia Protocol Plugin"),
+	                                                  /**  description    */
+	N_("Trepia Protocol Plugin"),
+	"Christian Hammond <chipx86@gnupdate.org>",       /**< author         */
+	WEBSITE,                                          /**< homepage       */
+
+	NULL,                                             /**< load           */
+	NULL,                                             /**< unload         */
+	NULL,                                             /**< destroy        */
+
+	NULL,                                             /**< ui_info        */
+	&prpl_info                                        /**< extra_info     */
+};
+
+static void
+__init_plugin(GaimPlugin *plugin)
+{
+	GaimAccountOption *option;
+
+	option = gaim_account_option_string_new(_("Login server"), "server",
+											TREPIA_SERVER);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+											   option);
+
+	option = gaim_account_option_int_new(_("Port"), "port", TREPIA_PORT);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+											   option);
+
+	my_protocol = plugin;
+}
+
+GAIM_INIT_PLUGIN(trepia, __init_plugin, info);
--- a/src/prpl.h	Wed Jun 04 02:17:03 2003 +0000
+++ b/src/prpl.h	Wed Jun 04 03:57:26 2003 +0000
@@ -59,7 +59,8 @@
 	GAIM_PROTO_RVP,         /**< RVP protocol              */
 	GAIM_PROTO_BACKRUB,     /**< Instant Massager protocol */
 	GAIM_PROTO_MOO,         /**< MOO protocol              */
-	GAIM_PROTO_ELVIN,	/**< Elvin Protocol	       */
+	GAIM_PROTO_ELVIN,       /**< Elvin Protocol            */
+	GAIM_PROTO_TREPIA,      /**< Trepia IM protocol        */
 	GAIM_PROTO_UNTAKEN      /**< Untaken protocol number   */
 
 } GaimProtocol;