You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(63) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(2) |
2006 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gary K. <amc...@us...> - 2005-01-08 10:55:45
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19178/src Modified Files: bnet.h Log Message: add the commands reference.. I might be getting around to implementing them tonight.. |
From: Gary K. <amc...@us...> - 2005-01-08 10:54:42
|
Update of /cvsroot/gaim-bnet/gaim-bnet/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19023/doc Log Message: Directory /cvsroot/gaim-bnet/gaim-bnet/doc added to the repository |
From: Gary K. <amc...@us...> - 2005-01-08 10:34:57
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16042/src Modified Files: bnet.c bnet.h buddy.c buddy.h conn.c conn.h proto.c proto.h Log Message: Wow look at the mess I've created.. Just joking, got just about everything where I want it now.. Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** bnet.c 8 Jan 2005 10:07:32 -0000 1.15 --- bnet.c 8 Jan 2005 10:34:46 -0000 1.16 *************** *** 32,35 **** --- 32,37 ---- #include "bnet.h" + #include "buddy.h" + #include "conn.h" #include "intl.h" Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bnet.h 8 Jan 2005 10:07:32 -0000 1.6 --- bnet.h 8 Jan 2005 10:34:46 -0000 1.7 *************** *** 53,59 **** #include <roomlist.h> - #include "buddy.h" - #include "conn.h" - #include "proto.h" - #endif /* BNET_H */ --- 53,55 ---- Index: buddy.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** buddy.h 8 Jan 2005 10:07:32 -0000 1.2 --- buddy.h 8 Jan 2005 10:34:46 -0000 1.3 *************** *** 1,7 **** /* - * @file bnet.h - * * gaim-bnet Protocol Plugin - * * Copyright (C) 2004 by folks in AUTHORS file * --- 1,4 ---- *************** *** 32,35 **** --- 29,33 ---- #include "bnet.h" + #include "conn.h" struct _BNetUser { *************** *** 60,63 **** --- 58,62 ---- BNetBuddy *bnet_buddy_new(const gchar *name); void bnet_buddy_free(BNetBuddy *buddy); + void bnet_buddy_add_default(BNetConn *conn, const gchar *name); /* Buddies API */ Index: proto.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** proto.h 8 Jan 2005 10:19:53 -0000 1.4 --- proto.h 8 Jan 2005 10:34:46 -0000 1.5 *************** *** 29,32 **** --- 29,34 ---- typedef struct _BNetProtoProcInfo BNetProtoProcInfo; + #include "conn.h" + typedef void (*BNetProtoProcFunc)(BNetConn *, const gchar **); Index: conn.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/conn.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** conn.h 8 Jan 2005 10:07:32 -0000 1.1 --- conn.h 8 Jan 2005 10:34:46 -0000 1.2 *************** *** 66,70 **** gint bnet_conn_send(BNetConn *conn, const gchar *fmt, ...); void bnet_conn_update_progress(BNetConn *conn, BNetConnState cs); - void bnet_conn_add_buddy_default(BNetConn *conn, const gchar *name); void bnet_conn_request_friends_list(BNetConn *conn); --- 66,69 ---- Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** proto.c 8 Jan 2005 10:19:53 -0000 1.5 --- proto.c 8 Jan 2005 10:34:46 -0000 1.6 *************** *** 30,33 **** --- 30,34 ---- #include "proto.h" + #include "buddy.h" #define IS_NUM(c) ((c) >= '0' && (c) <= '9') *************** *** 132,136 **** b = g_hash_table_lookup(conn->buddies, nick); if (!b) ! bnet_conn_add_buddy_default(conn, nick); if (!strcmp(state,"offline")) --- 133,137 ---- b = g_hash_table_lookup(conn->buddies, nick); if (!b) ! bnet_buddy_add_default(conn, nick); if (!strcmp(state,"offline")) Index: buddy.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** buddy.c 8 Jan 2005 10:07:32 -0000 1.2 --- buddy.c 8 Jan 2005 10:34:46 -0000 1.3 *************** *** 120,123 **** --- 120,144 ---- } + void + bnet_buddy_add_default(BNetConn *conn, const gchar *name) { + GaimBuddy *buddy; + GaimGroup *group; + + g_return_if_fail(conn); + g_return_if_fail(name); + + buddy = gaim_buddy_new(conn->account, name, NULL); + group = gaim_find_group(BNET_DEFAULT_GROUP_NAME); + + if(!group) { + group = gaim_group_new(BNET_DEFAULT_GROUP_NAME); + gaim_blist_add_group(group, NULL); + } + + /* shouldn't we be adding the buddy to the hash table here? */ + + gaim_blist_add_buddy(buddy, NULL, group, NULL); + } + /****************************************************************************** * Buddies API Index: conn.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/conn.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** conn.c 8 Jan 2005 10:07:32 -0000 1.1 --- conn.c 8 Jan 2005 10:34:46 -0000 1.2 *************** *** 20,24 **** --- 20,26 ---- */ #include "conn.h" + #include "buddy.h" #include "intl.h" + #include "proto.h" static const gchar *status[] = { *************** *** 65,89 **** void - bnet_conn_add_buddy_default(BNetConn *conn, const gchar *name) { - GaimBuddy *b; - GaimGroup *g; - - g_return_if_fail(conn); - g_return_if_fail(name); - - b = gaim_buddy_new(conn->account, name, NULL); - g = gaim_find_group(BNET_DEFAULT_GROUP_NAME); - - if(!g) { - g = gaim_group_new(BNET_DEFAULT_GROUP_NAME); - gaim_blist_add_group(g, NULL); - } - - /* shouldn't we be adding the buddy to the hash table here? */ - - gaim_blist_add_buddy(b, NULL, g, NULL); - } - - void bnet_conn_request_friends_list(BNetConn *conn) { g_return_if_fail(conn); --- 67,70 ---- |
From: Gary K. <amc...@us...> - 2005-01-08 10:20:02
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/src Modified Files: proto.c proto.h Log Message: some more cleanups.. Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** proto.c 8 Jan 2005 10:07:32 -0000 1.4 --- proto.c 8 Jan 2005 10:19:53 -0000 1.5 *************** *** 31,41 **** #include "proto.h" - #define PROTO_MAX_ARGS 5 - #define PROTO_MSG_N (sizeof(_bnet_proto_proc_table) / \ - sizeof(_bnet_proto_proc_table[0])) - #define IS_NUM(c) ((c) >= '0' && (c) <= '9') ! void bnet_proto_msg_user(BNetConn *conn, const gchar** args) { BNetUser *u; --- 31,37 ---- #include "proto.h" #define IS_NUM(c) ((c) >= '0' && (c) <= '9') ! static void bnet_proto_msg_user(BNetConn *conn, const gchar** args) { BNetUser *u; *************** *** 54,58 **** } ! void bnet_proto_msg_join(BNetConn *conn, const gchar** args) { // reasons to distinguish between JOIN and USER ? --- 50,54 ---- } ! static void bnet_proto_msg_join(BNetConn *conn, const gchar** args) { // reasons to distinguish between JOIN and USER ? *************** *** 60,64 **** } ! void bnet_proto_msg_leave(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; --- 56,60 ---- } ! static void bnet_proto_msg_leave(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; *************** *** 72,76 **** } ! void bnet_proto_msg_whispearf(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; --- 68,72 ---- } ! static void bnet_proto_msg_whispearf(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; *************** *** 81,85 **** } ! void bnet_proto_msg_talk(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; --- 77,81 ---- } ! static void bnet_proto_msg_talk(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; *************** *** 90,94 **** } ! void bnet_proto_msg_channel(BNetConn *conn, const gchar** args) { const gchar* chan = args[0]; --- 86,90 ---- } ! static void bnet_proto_msg_channel(BNetConn *conn, const gchar** args) { const gchar* chan = args[0]; *************** *** 101,105 **** } ! void bnet_proto_msg_userflg(BNetConn *conn, const gchar** args) { // useless and never seen --- 97,101 ---- } ! static void bnet_proto_msg_userflg(BNetConn *conn, const gchar** args) { // useless and never seen *************** *** 107,111 **** } ! void bnet_proto_msg_whispeart(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; --- 103,107 ---- } ! static void bnet_proto_msg_whispeart(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; *************** *** 116,120 **** } ! void bnet_proto_msg_info(BNetConn *conn, const gchar** args) { const gchar* info = args[0]; --- 112,116 ---- } ! static void bnet_proto_msg_info(BNetConn *conn, const gchar** args) { const gchar* info = args[0]; *************** *** 148,152 **** } ! void bnet_proto_msg_error(BNetConn *conn, const gchar** args) { const gchar* error = args[0]; --- 144,148 ---- } ! static void bnet_proto_msg_error(BNetConn *conn, const gchar** args) { const gchar* error = args[0]; *************** *** 155,159 **** } ! void bnet_proto_msg_emote(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; --- 151,155 ---- } ! static void bnet_proto_msg_emote(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; *************** *** 164,173 **** } ! void bnet_proto_msg_ping(BNetConn *conn, const gchar** args) { gaim_debug_info("bnet", "PING\n"); } ! void bnet_proto_msg_name(BNetConn *conn, const gchar** args) { const gchar* name = args[0]; --- 160,169 ---- } ! static void bnet_proto_msg_ping(BNetConn *conn, const gchar** args) { gaim_debug_info("bnet", "PING\n"); } ! static void bnet_proto_msg_name(BNetConn *conn, const gchar** args) { const gchar* name = args[0]; *************** *** 176,186 **** } ! /*****************************************************************************/ ! ! struct bnet_proto_proc_info { ! guint id; ! guint args_n; ! void (*proc_func)(BNetConn *, const gchar**); ! } _bnet_proto_proc_table[] = { { 1001, 3, bnet_proto_msg_user }, { 1002, 3, bnet_proto_msg_join }, --- 172,179 ---- } ! /****************************************************************************** ! * Protocol Procedures ! *****************************************************************************/ ! static BNetProtoProcInfo ppi[] = { { 1001, 3, bnet_proto_msg_user }, { 1002, 3, bnet_proto_msg_join }, *************** *** 198,201 **** --- 191,200 ---- }; + #define PROTO_MAX_ARGS 5 + #define PROTO_MSG_N (sizeof(ppi) / sizeof(ppi[0])) + + /****************************************************************************** + * API + *****************************************************************************/ void bnet_proto_process_msg(BNetConn *conn, const gchar* msg) { *************** *** 226,230 **** for (i = 0; i < PROTO_MSG_N; i++) { ! struct bnet_proto_proc_info* pi = _bnet_proto_proc_table+i; if (pi->id == id) { if (pi->args_n+2 != args_n) { --- 225,230 ---- for (i = 0; i < PROTO_MSG_N; i++) { ! BNetProtoProcInfo *pi = ppi + i; ! if (pi->id == id) { if (pi->args_n+2 != args_n) { *************** *** 232,236 **** } else { ! pi->proc_func(conn, (const gchar**)args+2); } break; --- 232,236 ---- } else { ! pi->func(conn, (const gchar**)args+2); } break; Index: proto.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** proto.h 8 Jan 2005 10:07:32 -0000 1.3 --- proto.h 8 Jan 2005 10:19:53 -0000 1.4 *************** *** 27,30 **** --- 27,40 ---- #include "bnet.h" + typedef struct _BNetProtoProcInfo BNetProtoProcInfo; + + typedef void (*BNetProtoProcFunc)(BNetConn *, const gchar **); + + struct _BNetProtoProcInfo { + guint id; + guint args_n; + BNetProtoProcFunc func; + }; + #ifdef __cplusplus extern "C" { |
From: Gary K. <amc...@us...> - 2005-01-08 10:07:43
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12058/src Modified Files: Makefile.am bnet.c bnet.h buddy.c buddy.h proto.c proto.h Added Files: conn.c conn.h Log Message: A lot more clean ups.. I've got a bit to go yet.. And if i broke anything you're working on... sorry... Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** bnet.c 8 Jan 2005 07:21:12 -0000 1.14 --- bnet.c 8 Jan 2005 10:07:32 -0000 1.15 *************** *** 33,44 **** #include "bnet.h" #include "intl.h" - #include "proto.h" - - #define BNET_DEFAULT_SERVER "europe.battle.net" - #define BNET_DEFAULT_PORT 6112 - - #define BNET_DEFAULT_GROUP_NAME "BNet" - - #define BNET_INITIAL_BUFSIZE 1024 static GaimPlugin *_bnet_plugin = NULL; --- 33,36 ---- *************** *** 46,316 **** ///////////////////////////////////////////////// ! gint bnet_sock_send(struct bnet_conn* bnet, const gchar* fmt, ...) ! { ! va_list ap; ! gchar* buf; ! gint ret; ! ! va_start(ap, fmt); ! vasprintf(&buf, fmt, ap); ! va_end(ap); ! ret = send(bnet->fd, buf, strlen(buf), 0); ! free(buf); ! ! return ret; ! } ! ! void bnet_connection_update_progress(struct bnet_conn* bnet, bnet_conn_state s) ! { ! static const gchar* status[] = { ! N_("Connecting to server"), ! N_("Sending username"), ! N_("Sending password"), ! N_("Waiting confirmation"), ! N_("Connected") ! }; ! ! bnet->state = s; ! gaim_connection_update_progress( ! gaim_account_get_connection(bnet->account), ! _(status[bnet->state-1]), bnet->state, CS_LAST); ! } ! ! void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name) ! { ! GaimBuddy *b = gaim_buddy_new(bnet->account, name, NULL); ! GaimGroup *g = gaim_find_group(BNET_DEFAULT_GROUP_NAME); ! ! if (!g) { ! g = gaim_group_new(BNET_DEFAULT_GROUP_NAME); ! gaim_blist_add_group(g, NULL); ! } ! ! /*b->present = present; ! b->idle = idle; ! b->uc = state;*/ ! ! gaim_blist_add_buddy(b, NULL, g, NULL); ! } ! ! ! void bnet_req_friends_list(struct bnet_conn* bnet) ! { ! bnet_sock_send(bnet, "/f l\n"); ! } ! ! ///////////////////////////////////////////////// ! ! static void bnet_raw_request_cb(GaimConnection *gc, char *msg) ! { ! struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; ! ! if (g_list_find(gaim_connections_get_all(), gc)) { ! gaim_debug_info("bnet", ! "bnet_raw_request_cb: sending raw message - \"%s\"\n", ! msg); ! bnet_sock_send(bnet, "%s\n", msg); ! } } ///////////////////////////////////////////////// ! static int bnet_send_im(GaimConnection *gc, ! const char *who, ! const char *what, ! GaimConvImFlags imflags) { ! struct bnet_conn *bnet; ! const char *args[2]; ! gaim_debug_info("bnet", "bnet_send_im\n"); ! bnet = gc->proto_data; ! args[0] = who; ! args[1] = what; - bnet_sock_send(bnet, "/w %s %s\n", who, what); return 1; }; ! static const char *bnet_icon(GaimAccount *a, GaimBuddy *b) ! { return "bnet"; } ! static void bnet_parse_msg(struct bnet_conn* bnet, const gchar* msg) ! { ! GaimConnection* gc = gaim_account_get_connection(bnet->account); ! ! switch (bnet->state) { ! case CS_SOCK: // NR ! break; ! case CS_USER: ! if (!strcmp(msg,"Username: ")) { ! bnet_sock_send(bnet, "%s\n", bnet->user); ! bnet_connection_update_progress(bnet, CS_PASS); ! } ! break; ! case CS_PASS: ! if (!strcmp(msg,"Password: ")) { ! bnet_sock_send(bnet, "%s\n", bnet->pass); ! bnet_connection_update_progress(bnet, CS_VRFY); ! } ! break; ! case CS_VRFY: ! if (!strstr(msg,"incorrect")) { ! bnet_connection_update_progress(bnet, CS_CONN); ! gaim_connection_set_state(gc, GAIM_CONNECTED); ! ! bnet_req_friends_list(bnet); ! } ! else ! bnet_connection_update_progress(bnet, CS_USER); ! break; ! case CS_CONN: ! bnet_proto_process_msg(bnet, msg); ! break; ! } ! } ! ! static void bnet_input_cb(gpointer data, gint source, GaimInputCondition cond) ! { ! GaimConnection* gc = data; ! struct bnet_conn* bnet = gc->proto_data; ! gchar *cur, *end; ! gint len; ! ! if (bnet->inbuflen < bnet->inbufused + BNET_INITIAL_BUFSIZE) { ! bnet->inbuflen += BNET_INITIAL_BUFSIZE; ! bnet->inbuf = g_realloc(bnet->inbuf, bnet->inbuflen); ! } ! ! if ((len = read(bnet->fd, bnet->inbuf + bnet->inbufused, BNET_INITIAL_BUFSIZE-1)) < 0) { ! gaim_connection_error(gc, _("Read error")); ! return; ! } else if (len == 0) { ! /* Remote closed the connection, probably */ ! return; ! } ! ! bnet->inbufused += len; ! bnet->inbuf[bnet->inbufused] = '\0'; ! ! /* We must switch between the two cases because in CS_USER and CS_PASS states ! * input is NOT line buffered */ ! if (bnet->state == CS_CONN || bnet->state == CS_VRFY) { ! cur = bnet->inbuf; ! while (cur < bnet->inbuf + bnet->inbufused && ! ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { ! gint step = (*end == '\r' ? 2 : 1); ! *end = '\0'; ! if (cur != end) ! bnet_parse_msg(bnet, cur); ! cur = end + step; ! } ! if (cur != bnet->inbuf + bnet->inbufused) { /* leftover */ ! bnet->inbufused -= (cur - bnet->inbuf); ! memmove(bnet->inbuf, cur, bnet->inbufused); ! } else { ! bnet->inbufused = 0; ! } ! } ! else { ! bnet_parse_msg(bnet, bnet->inbuf); ! bnet->inbufused = 0; ! } ! } ! ! static void bnet_login_cb(gpointer data, gint source, GaimInputCondition cond) ! { ! GaimConnection* gc = data; ! struct bnet_conn* bnet = gc->proto_data; ! GList* connections = gaim_connections_get_all(); ! ! if (source < 0) ! return; ! ! if (!g_list_find(connections, gc)) { ! close(source); ! return; ! } ! ! bnet->fd = source; ! ! gc->inpa = gaim_input_add(bnet->fd, GAIM_INPUT_READ, bnet_input_cb, gc); ! ! bnet_sock_send(bnet, "\003\004%s", bnet->user); ! bnet_connection_update_progress(bnet, CS_USER); ! } ! ! static void bnet_login(GaimAccount *account) ! { ! GaimConnection *gc; ! struct bnet_conn *bnet; ! gint err; ! ! gaim_debug_info("bnet", "bnet_login\n"); ! ! gc = gaim_account_get_connection(account); ! gc->proto_data = bnet = g_new0(struct bnet_conn, 1); ! bnet->account = account; ! ! bnet->user = gaim_account_get_username(account); ! bnet->pass = gc->account->password; ! ! bnet->users = g_hash_table_new_full( ! (GHashFunc)bnet_nick_get_hash, (GEqualFunc)bnet_nicks_equal, ! NULL, (GDestroyNotify)bnet_user_free); ! bnet->buddies = g_hash_table_new_full( ! (GHashFunc)bnet_nick_get_hash, (GEqualFunc)bnet_nicks_equal, ! NULL, (GDestroyNotify)bnet_buddy_free); ! ! bnet_connection_update_progress(bnet, CS_SOCK); ! ! err = gaim_proxy_connect(account, ! gaim_account_get_string(account, "server", BNET_DEFAULT_SERVER), ! gaim_account_get_int(account, "port", BNET_DEFAULT_PORT), ! bnet_login_cb, ! gc); ! ! if (err || !account->gc) ! gaim_connection_error(gc, _("Couldn't create socket")); ! ! //serv_finish_login(gc); ! }; ! ! static void bnet_close(GaimConnection *gc) ! { ! struct bnet_conn *bnet; ! gaim_debug_info("bnet", "bnet_close\n"); ! ! bnet = gc->proto_data; ! ! if (bnet == NULL) ! return; ! ! // bnet_reset(gc, bnet); ! g_free(bnet); ! }; ! ! static void bnet_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) ! { ! struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; ! struct bnet_buddy *b = bnet_buddy_new(buddy->name); ! gaim_debug_info("bnet", "bnet_add_buddy\n"); ! g_hash_table_insert(bnet->buddies, b->name, b); }; ! static void bnet_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) ! { ! struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; ! gaim_debug_info("bnet", "bnet_remove_buddy\n"); ! g_hash_table_remove(bnet->buddies, buddy->name); }; --- 38,92 ---- ///////////////////////////////////////////////// ! static void ! bnet_raw_request_cb(GaimConnection *gc, char *msg) { ! BNetConn *conn = BNET_CONN(gc->proto_data); ! if(g_list_find(gaim_connections_get_all(), gc)) { ! gaim_debug_info("bnet", ! "bnet_raw_request_cb: sending raw message - \"%s\"\n", ! msg); ! bnet_conn_send(conn, "%s\n", msg); ! } } ///////////////////////////////////////////////// ! static int ! bnet_send_im(GaimConnection *gc, const char *who, const char *what, ! GaimConvImFlags imflags) { ! BNetConn *conn; ! gaim_debug_info("bnet", "bnet_send_im\n"); ! conn = BNET_CONN(gc->proto_data); ! bnet_conn_send(conn, "/w %s %s\n", who, what); return 1; }; ! static const char * ! bnet_icon(GaimAccount *a, GaimBuddy *b) { return "bnet"; } ! static void ! bnet_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { ! BNetConn *conn = BNET_CONN(gc->proto_data); ! BNetBuddy *b = bnet_buddy_new(buddy->name); ! gaim_debug_info("bnet", "bnet_add_buddy\n"); ! g_hash_table_insert(conn->buddies, b->name, b); }; ! static void ! bnet_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { ! BNetConn *conn = BNET_CONN(gc->proto_data); ! gaim_debug_info("bnet", "bnet_remove_buddy\n"); ! g_hash_table_remove(conn->buddies, buddy->name); }; *************** *** 355,360 **** NULL, /* chat_info */ NULL, /* chat_info_defaults */ ! bnet_login, /* login */ ! bnet_close, /* close */ bnet_send_im, /* send_im */ NULL, /* set_info */ --- 131,136 ---- NULL, /* chat_info */ NULL, /* chat_info_defaults */ ! bnet_conn_login, /* login */ ! bnet_conn_close, /* close */ bnet_send_im, /* send_im */ NULL, /* set_info */ Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bnet.h 8 Jan 2005 07:21:12 -0000 1.5 --- bnet.h 8 Jan 2005 10:07:32 -0000 1.6 *************** *** 28,31 **** --- 28,39 ---- #define GAIM_PLUGINS + #define BNET_DEFAULT_SERVER "europe.battle.net" + #define BNET_DEFAULT_PORT 6112 + + #define BNET_DEFAULT_GROUP_NAME "BNet" + + #define BNET_INITIAL_BUFSIZE 1024 + + #include <glib.h> #include <string.h> #include <sys/socket.h> *************** *** 46,95 **** #include "buddy.h" ! ! typedef enum { ! CS_SOCK = 1, ! CS_USER, ! CS_PASS, ! CS_VRFY, ! CS_CONN, ! } bnet_conn_state; ! ! #define CS_LAST CS_CONN ! ! struct bnet_user { ! gchar* nick; ! gchar* game; ! gchar* flags; ! }; ! ! struct bnet_buddy { ! gchar* name; ! gboolean online; ! gchar* flags; ! gchar* location; ! }; ! ! struct bnet_conn { ! GaimAccount* account; ! ! const gchar* user; ! const gchar* pass; ! ! bnet_conn_state state; ! ! gint fd; ! gchar* inbuf; ! guint inbuflen, inbufused; ! GSList* exp; ! ! gchar* chan; ! GHashTable* users; // known user (on chan) ! ! gchar* away; ! ! GHashTable* buddies; ! }; ! ! void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name); #endif /* BNET_H */ --- 54,59 ---- #include "buddy.h" ! #include "conn.h" ! #include "proto.h" #endif /* BNET_H */ Index: buddy.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buddy.h 8 Jan 2005 07:21:12 -0000 1.1 --- buddy.h 8 Jan 2005 10:07:32 -0000 1.2 *************** *** 25,33 **** #define BNET_BUDDY_H ! #include "bnet.h" typedef struct _BNetUser BNetUser; typedef struct _BNetBuddy BNetBuddy; struct _BNetUser { gchar* nick; --- 25,36 ---- #define BNET_BUDDY_H ! #define BNET_BUDDY(obj) ((BNetBuddy *)obj) ! #define BNET_USER(obj) ((BNetUser *)obj) typedef struct _BNetUser BNetUser; typedef struct _BNetBuddy BNetBuddy; + #include "bnet.h" + struct _BNetUser { gchar* nick; *************** *** 47,62 **** #endif /* __cplusplus */ - /* Nick API */ - guint bnet_nick_get_hash(const gchar *nick); - gboolean bnet_nicks_equal(const gchar *nick1, const gchar *nick2); - /* User API */ BNetUser *bnet_user_new(const gchar *nick, const gchar *game, const gchar *flags); void bnet_user_free(BNetUser *user); /* Buddy API */ BNetBuddy *bnet_buddy_new(const gchar *name); void bnet_buddy_free(BNetBuddy *buddy); #ifdef __cplusplus } --- 50,67 ---- #endif /* __cplusplus */ /* User API */ BNetUser *bnet_user_new(const gchar *nick, const gchar *game, const gchar *flags); void bnet_user_free(BNetUser *user); + /* Users API */ + GHashTable *bnet_users_new(); + /* Buddy API */ BNetBuddy *bnet_buddy_new(const gchar *name); void bnet_buddy_free(BNetBuddy *buddy); + /* Buddies API */ + GHashTable *bnet_buddies_new(); + #ifdef __cplusplus } Index: proto.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** proto.h 8 Jan 2005 06:23:25 -0000 1.2 --- proto.h 8 Jan 2005 10:07:32 -0000 1.3 *************** *** 22,30 **** * $Id$ */ - #ifndef PROTO_H #define PROTO_H ! void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg); #endif /* PROTO_H */ --- 22,39 ---- * $Id$ */ #ifndef PROTO_H #define PROTO_H ! #include "bnet.h" ! ! #ifdef __cplusplus ! extern "C" { ! #endif /* __cplusplus */ ! ! void bnet_proto_process_msg(BNetConn *conn, const gchar* msg); ! ! #ifdef __cplusplus ! } ! #endif /* __cplusplus */ #endif /* PROTO_H */ --- NEW FILE: conn.h --- /* * gaim-bnet Protocol Plugin * Copyright (C) 2004-2005 by folks in AUTHORS file * * 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 * * $Id: conn.h,v 1.1 2005/01/08 10:07:32 amc_grim Exp $ */ #ifndef BNET_CONN_H #define BNET_CONN_H #define BNET_CONN(obj) ((BNetConn *)obj) typedef struct _BNetConn BNetConn; typedef enum _BNetConnState BNetConnState; #include "bnet.h" enum _BNetConnState { BNET_CS_SOCK = 1, BNET_CS_USER, BNET_CS_PASS, BNET_CS_VRFY, BNET_CS_CONN, BNET_CS_LAST }; struct _BNetConn { GaimAccount *account; const gchar *user; const gchar *pass; BNetConnState state; gint fd; gchar *inbuf; guint inbuf_len; guint inbuf_used; GSList *exp; gchar *chan; GHashTable *users; gchar *away; GHashTable *buddies; }; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ gint bnet_conn_send(BNetConn *conn, const gchar *fmt, ...); void bnet_conn_update_progress(BNetConn *conn, BNetConnState cs); void bnet_conn_add_buddy_default(BNetConn *conn, const gchar *name); void bnet_conn_request_friends_list(BNetConn *conn); void bnet_conn_login(GaimAccount *account); void bnet_conn_close(GaimConnection *gc); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* BNET_CONN_H */ Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** proto.c 8 Jan 2005 06:00:06 -0000 1.3 --- proto.c 8 Jan 2005 10:07:32 -0000 1.4 *************** *** 29,33 **** #include <string.h> ! #include "bnet.h" #define PROTO_MAX_ARGS 5 --- 29,33 ---- #include <string.h> ! #include "proto.h" #define PROTO_MAX_ARGS 5 *************** *** 37,78 **** #define IS_NUM(c) ((c) >= '0' && (c) <= '9') ! void bnet_proto_msg_user(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; const gchar* game = args[1]; const gchar* flags = args[2]; ! struct bnet_user* u; ! ! u = (struct bnet_user*)g_hash_table_lookup(bnet->users, nick); if (!u) { u = bnet_user_new(nick, game, flags); ! g_hash_table_insert(bnet->users, u->nick, u); } gaim_debug_info("bnet", "USER %02u users on chan now!\n", ! g_hash_table_size(bnet->users)); } ! void bnet_proto_msg_join(struct bnet_conn* bnet, const gchar** args) ! { // reasons to distinguish between JOIN and USER ? ! bnet_proto_msg_user(bnet, args); } ! void bnet_proto_msg_leave(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; //const gchar* game = args[1]; //const gchar* flags = args[2]; ! g_hash_table_remove(bnet->users, nick); gaim_debug_info("bnet", "LEAVE %02u users on chan now!\n", ! g_hash_table_size(bnet->users)); } ! void bnet_proto_msg_whispearf(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; //const gchar* game = args[1]; --- 37,77 ---- #define IS_NUM(c) ((c) >= '0' && (c) <= '9') ! void ! bnet_proto_msg_user(BNetConn *conn, const gchar** args) { ! BNetUser *u; const gchar* nick = args[0]; const gchar* game = args[1]; const gchar* flags = args[2]; ! u = BNET_USER(g_hash_table_lookup(conn->users, nick)); if (!u) { u = bnet_user_new(nick, game, flags); ! g_hash_table_insert(conn->users, u->nick, u); } gaim_debug_info("bnet", "USER %02u users on chan now!\n", ! g_hash_table_size(conn->users)); } ! void ! bnet_proto_msg_join(BNetConn *conn, const gchar** args) { // reasons to distinguish between JOIN and USER ? ! bnet_proto_msg_user(conn, args); } ! void ! bnet_proto_msg_leave(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; //const gchar* flags = args[2]; ! g_hash_table_remove(conn->users, nick); gaim_debug_info("bnet", "LEAVE %02u users on chan now!\n", ! g_hash_table_size(conn->users)); } ! void ! bnet_proto_msg_whispearf(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; *************** *** 82,87 **** } ! void bnet_proto_msg_talk(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; //const gchar* game = args[1]; --- 81,86 ---- } ! void ! bnet_proto_msg_talk(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; *************** *** 91,114 **** } ! void bnet_proto_msg_channel(struct bnet_conn* bnet, const gchar** args) ! { const gchar* chan = args[0]; ! if (bnet->chan) ! g_free(bnet->chan); ! bnet->chan = g_strdup(chan); gaim_debug_info("bnet", "CHAN %s\n", chan); } ! void bnet_proto_msg_userflg(struct bnet_conn* bnet, const gchar** args) ! { // useless and never seen gaim_debug_info("bnet", "USERFLG\n"); } ! void bnet_proto_msg_whispeart(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; //const gchar* game = args[1]; --- 90,112 ---- } ! void ! bnet_proto_msg_channel(BNetConn *conn, const gchar** args) { const gchar* chan = args[0]; ! g_free(conn->chan); ! conn->chan = g_strdup(chan); gaim_debug_info("bnet", "CHAN %s\n", chan); } ! void ! bnet_proto_msg_userflg(BNetConn *conn, const gchar** args) { // useless and never seen gaim_debug_info("bnet", "USERFLG\n"); } ! void ! bnet_proto_msg_whispeart(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; *************** *** 118,123 **** } ! void bnet_proto_msg_info(struct bnet_conn* bnet, const gchar** args) ! { const gchar* info = args[0]; guint len = strlen(info); --- 116,121 ---- } ! void ! bnet_proto_msg_info(BNetConn *conn, const gchar** args) { const gchar* info = args[0]; guint len = strlen(info); *************** *** 125,134 **** gaim_debug_info("bnet", "INFO %s\n", info); ! if (len > 4 && ! ((info[1] == ':' && IS_NUM(info[0])) || ! (info[2] == ':' && IS_NUM(info[0]) && IS_NUM(info[1])))) { ! GaimConnection *gc = gaim_account_get_connection(bnet->account); gchar *p, *nick, *state; - struct bnet_buddy* b; p = strchr(info,' '); --- 123,132 ---- gaim_debug_info("bnet", "INFO %s\n", info); ! if(len > 4 && ! ((info[1] == ':' && IS_NUM(info[0])) || ! (info[2] == ':' && IS_NUM(info[0]) && IS_NUM(info[1])))) { ! BNetBuddy *b; ! GaimConnection *gc = gaim_account_get_connection(conn->account); gchar *p, *nick, *state; p = strchr(info,' '); *************** *** 136,142 **** sscanf(p, " %a[^,], %as", &nick, &state); ! b = g_hash_table_lookup(bnet->buddies, nick); if (!b) ! bnet_add_default_buddy(bnet, nick); if (!strcmp(state,"offline")) --- 134,140 ---- sscanf(p, " %a[^,], %as", &nick, &state); ! b = g_hash_table_lookup(conn->buddies, nick); if (!b) ! bnet_conn_add_buddy_default(conn, nick); if (!strcmp(state,"offline")) *************** *** 150,155 **** } ! void bnet_proto_msg_error(struct bnet_conn* bnet, const gchar** args) ! { const gchar* error = args[0]; --- 148,153 ---- } ! void ! bnet_proto_msg_error(BNetConn *conn, const gchar** args) { const gchar* error = args[0]; *************** *** 157,162 **** } ! void bnet_proto_msg_emote(struct bnet_conn* bnet, const gchar** args) ! { const gchar* nick = args[0]; //const gchar* game = args[1]; --- 155,160 ---- } ! void ! bnet_proto_msg_emote(BNetConn *conn, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; *************** *** 166,176 **** } ! void bnet_proto_msg_ping(struct bnet_conn* bnet, const gchar** args) ! { gaim_debug_info("bnet", "PING\n"); } ! void bnet_proto_msg_name(struct bnet_conn* bnet, const gchar** args) ! { const gchar* name = args[0]; --- 164,174 ---- } ! void ! bnet_proto_msg_ping(BNetConn *conn, const gchar** args) { gaim_debug_info("bnet", "PING\n"); } ! void ! bnet_proto_msg_name(BNetConn *conn, const gchar** args) { const gchar* name = args[0]; *************** *** 178,187 **** } ! /////////////////////////////////////////////////////////////// struct bnet_proto_proc_info { guint id; guint args_n; ! void (*proc_func)(struct bnet_conn*, const gchar**); } _bnet_proto_proc_table[] = { { 1001, 3, bnet_proto_msg_user }, --- 176,185 ---- } ! /*****************************************************************************/ struct bnet_proto_proc_info { guint id; guint args_n; ! void (*proc_func)(BNetConn *, const gchar**); } _bnet_proto_proc_table[] = { { 1001, 3, bnet_proto_msg_user }, *************** *** 200,211 **** }; ! void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg) ! { guint id; gint i,l,b,e,len,args_n=0; gchar* args[PROTO_MAX_ARGS]; - //gaim_debug_info("bnet", "bnet_proto_process_msg\n"); - for (i=0,l=0,b=0,e=strlen(msg); i<PROTO_MAX_ARGS; i++,l++,b=l) { if (msg[l]=='"') --- 198,207 ---- }; ! void ! bnet_proto_process_msg(BNetConn *conn, const gchar* msg) { guint id; gint i,l,b,e,len,args_n=0; gchar* args[PROTO_MAX_ARGS]; for (i=0,l=0,b=0,e=strlen(msg); i<PROTO_MAX_ARGS; i++,l++,b=l) { if (msg[l]=='"') *************** *** 236,240 **** } else { ! pi->proc_func(bnet, (const gchar**)args+2); } break; --- 232,236 ---- } else { ! pi->proc_func(conn, (const gchar**)args+2); } break; Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 8 Jan 2005 07:21:12 -0000 1.5 --- Makefile.am 8 Jan 2005 10:07:32 -0000 1.6 *************** *** 2,5 **** --- 2,6 ---- bnet.h \ buddy.h \ + conn.h \ intl.h \ proto.h *************** *** 16,19 **** --- 17,21 ---- bnet.c \ buddy.c \ + conn.c \ proto.c Index: buddy.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/buddy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** buddy.c 8 Jan 2005 07:21:12 -0000 1.1 --- buddy.c 8 Jan 2005 10:07:32 -0000 1.2 *************** *** 24,28 **** * Nick API *****************************************************************************/ ! guint bnet_nick_get_hash(const gchar *nick) { gchar *down; --- 24,28 ---- * Nick API *****************************************************************************/ ! static guint bnet_nick_get_hash(const gchar *nick) { gchar *down; *************** *** 36,40 **** } ! gboolean bnet_nicks_equal(const gchar *nick1, const gchar *nick2) { return (gaim_utf8_strcasecmp(nick1, nick2) == 0); --- 36,40 ---- } ! static gboolean bnet_nicks_equal(const gchar *nick1, const gchar *nick2) { return (gaim_utf8_strcasecmp(nick1, nick2) == 0); *************** *** 77,80 **** --- 77,95 ---- /****************************************************************************** + * Users API + *****************************************************************************/ + GHashTable * + bnet_users_new() { + GHashTable *users; + + users = g_hash_table_new_full((GHashFunc)bnet_nick_get_hash, + (GEqualFunc)bnet_nicks_equal, + NULL, + (GDestroyNotify)bnet_user_free); + + return users; + } + + /****************************************************************************** * Buddy API *****************************************************************************/ *************** *** 104,105 **** --- 119,136 ---- buddy = NULL; } + + /****************************************************************************** + * Buddies API + *****************************************************************************/ + GHashTable * + bnet_buddies_new() { + GHashTable *buddies; + + buddies = g_hash_table_new_full((GHashFunc)bnet_nick_get_hash, + (GEqualFunc)bnet_nicks_equal, + NULL, + (GDestroyNotify)bnet_buddy_free); + + return buddies; + } + --- NEW FILE: conn.c --- /* * gaim-bnet Protocol Plugin * Copyright (C) 2004-2005 by folks in AUTHORS file * * 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 * * $Id: conn.c,v 1.1 2005/01/08 10:07:32 amc_grim Exp $ */ #include "conn.h" #include "intl.h" static const gchar *status[] = { N_("Connection to server"), N_("Sending username"), N_("Sending password"), N_("Waiting confirmation"), N_("Connected"), NULL }; gint bnet_conn_send(BNetConn *conn, const gchar *fmt, ...) { va_list args; gchar *buff; gint ret; g_return_val_if_fail(conn, -1); g_return_val_if_fail(fmt, -1); va_start(args, fmt); buff = g_strdup_vprintf(fmt, args); va_end(args); if(!buff) return -1; ret = send(conn->fd, buff, strlen(buff), 0); g_free(buff); return ret; } void bnet_conn_update_progress(BNetConn *conn, BNetConnState cs) { g_return_if_fail(conn); g_return_if_fail(cs > 0 && cs < BNET_CS_LAST); conn->state = cs; gaim_connection_update_progress(conn->account->gc, status[conn->state - 1], conn->state, BNET_CS_LAST); } void bnet_conn_add_buddy_default(BNetConn *conn, const gchar *name) { GaimBuddy *b; GaimGroup *g; g_return_if_fail(conn); g_return_if_fail(name); b = gaim_buddy_new(conn->account, name, NULL); g = gaim_find_group(BNET_DEFAULT_GROUP_NAME); if(!g) { g = gaim_group_new(BNET_DEFAULT_GROUP_NAME); gaim_blist_add_group(g, NULL); } /* shouldn't we be adding the buddy to the hash table here? */ gaim_blist_add_buddy(b, NULL, g, NULL); } void bnet_conn_request_friends_list(BNetConn *conn) { g_return_if_fail(conn); bnet_conn_send(conn, "/f l\n"); } /****************************************************************************** * Connection stuff... *****************************************************************************/ static void bnet_conn_parse_msg(BNetConn *conn, const gchar *msg) { switch(conn->state) { case BNET_CS_SOCK: break; case BNET_CS_USER: if(!strcmp(msg, "Username: ")) { bnet_conn_send(conn, "%s\n", conn->user); bnet_conn_update_progress(conn, BNET_CS_PASS); } break; case BNET_CS_PASS: if(!strcmp(msg, "Password: ")) { bnet_conn_send(conn, "%s\n", conn->pass); bnet_conn_update_progress(conn, BNET_CS_VRFY); } break; case BNET_CS_VRFY: if(!strstr(msg, "incorrect")) { GaimConnection *gc; gc = gaim_account_get_connection(conn->account); bnet_conn_update_progress(conn, BNET_CS_CONN); gaim_connection_set_state(gc, GAIM_CONNECTED); bnet_conn_request_friends_list(conn); } else { bnet_conn_update_progress(conn, BNET_CS_USER); } break; case BNET_CS_CONN: bnet_proto_process_msg(conn, msg); break; case BNET_CS_LAST: default: break; } } static void bnet_conn_input_cb(gpointer data, gint source, GaimInputCondition cond) { BNetConn *conn; GaimConnection *gc; gint len; gc = (GaimConnection *)data; conn = BNET_CONN(gc->proto_data); if(conn->inbuf_len < conn->inbuf_used + BNET_INITIAL_BUFSIZE) { conn->inbuf_len += BNET_INITIAL_BUFSIZE; conn->inbuf = g_realloc(conn->inbuf, conn->inbuf_len); } len = read(conn->fd, conn->inbuf + conn->inbuf_used, BNET_INITIAL_BUFSIZE - 1); if(len < 0) { gaim_connection_error(gc, _("Read error")); return; } else if(len == 0) { /* Remote probably closed the connection */ return; } conn->inbuf_used += len; conn->inbuf[conn->inbuf_used] = '\0'; /* We must swtich between the two cases beacuse input is _NOT_ line * buffered in the BNET_CS_USER and BNET_CS_PASS states */ if(conn->state == BNET_CS_CONN || conn->state == BNET_CS_VRFY) { gchar *cur, *end; cur = conn->inbuf; while(cur < conn->inbuf + conn->inbuf_used && ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { gint step = (*end == '\r' ? 2 : 1); *end = '\0'; if(cur != end) bnet_conn_parse_msg(conn, cur); cur = end + step; } /* mmm leftovers */ if(cur != conn->inbuf + conn->inbuf_used) { conn->inbuf_used -= (cur - conn->inbuf); memmove(conn->inbuf, cur, conn->inbuf_used); } else { conn->inbuf_used = 0; } } else { bnet_conn_parse_msg(conn, conn->inbuf); conn->inbuf_used = 0; } } static void bnet_conn_login_cb(gpointer data, gint source, GaimInputCondition cond) { BNetConn *conn; GaimConnection *gc; GList *l; if(source < 0) return; gc = (GaimConnection *)data; l = gaim_connections_get_all(); if(!g_list_find(l, gc)) { close(source); return; } conn = BNET_CONN(gc->proto_data); conn->fd = source; gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, bnet_conn_input_cb, gc); bnet_conn_send(conn, "\003\004%s", conn->user); bnet_conn_update_progress(conn, BNET_CS_USER); } void bnet_conn_login(GaimAccount *account) { GaimConnection *gc; BNetConn *conn; const gchar *server; gint err, port; gaim_debug_info("bnet", "bnet_conn_login\n"); conn = g_new0(BNetConn, 1); gc = gaim_account_get_connection(account); gc->proto_data = conn; conn->account = account; conn->user = gaim_account_get_username(account); conn->pass = gaim_account_get_password(account); conn->users = bnet_users_new(); conn->buddies = bnet_buddies_new(); bnet_conn_update_progress(conn, BNET_CS_SOCK); server = gaim_account_get_string(account, "server", BNET_DEFAULT_SERVER); port = gaim_account_get_int(account, "port", BNET_DEFAULT_PORT); err = gaim_proxy_connect(account, server, port, bnet_conn_login_cb, gc); if(err || !account->gc) gaim_connection_error(gc, _("Could not create socket")); } void bnet_conn_close(GaimConnection *gc) { BNetConn *conn; gaim_debug_info("bnet", "bnet_conn_close\n"); conn = BNET_CONN(gc->proto_data); if(!conn) return; g_free(conn); conn = NULL; } |
From: Gary K. <amc...@us...> - 2005-01-08 07:21:25
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20471/src Modified Files: Makefile.am bnet.c bnet.h Added Files: buddy.c buddy.h Log Message: moved buddy/user/nick stuff to buddy.[ch] Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** bnet.c 8 Jan 2005 06:23:25 -0000 1.13 --- bnet.c 8 Jan 2005 07:21:12 -0000 1.14 *************** *** 46,105 **** ///////////////////////////////////////////////// - guint bnet_nick_hash(const gchar* nick) - { - gchar* t; - guint h; - - t = g_utf8_strdown(nick, -1); - h = g_str_hash(t); - g_free(t); - - return h; - } - - gboolean bnet_nick_equal(const gchar* nick1, const gchar* nick2) - { - return gaim_utf8_strcasecmp(nick1, nick2) == 0; - } - - struct bnet_user* bnet_user_new(const gchar* nick, const gchar* game, const gchar* flags) - { - struct bnet_user* u; - - u = g_new0(struct bnet_user, 1); - u->nick = g_strdup(nick); - u->game = g_strdup(game); - u->flags = g_strdup(flags); - - return u; - } - - void bnet_user_free(struct bnet_user* u) - { - g_free(u->nick); - g_free(u->game); - g_free(u->flags); - g_free(u); - } - - struct bnet_buddy* bnet_buddy_new(const gchar* name) - { - struct bnet_buddy* bd = g_new0(struct bnet_buddy, 1); - - bd->name = g_strdup(name); - - return bd; - } - - void bnet_buddy_free(struct bnet_buddy* bud) - { - g_free(bud->name); - g_free(bud->flags); - g_free(bud->location); - g_free(bud); - } - - ///////////////////////////////////////////////// - gint bnet_sock_send(struct bnet_conn* bnet, const gchar* fmt, ...) { --- 46,49 ---- *************** *** 318,325 **** bnet->users = g_hash_table_new_full( ! (GHashFunc)bnet_nick_hash, (GEqualFunc)bnet_nick_equal, NULL, (GDestroyNotify)bnet_user_free); bnet->buddies = g_hash_table_new_full( ! (GHashFunc)bnet_nick_hash, (GEqualFunc)bnet_nick_equal, NULL, (GDestroyNotify)bnet_buddy_free); --- 262,269 ---- bnet->users = g_hash_table_new_full( ! (GHashFunc)bnet_nick_get_hash, (GEqualFunc)bnet_nicks_equal, NULL, (GDestroyNotify)bnet_user_free); bnet->buddies = g_hash_table_new_full( ! (GHashFunc)bnet_nick_get_hash, (GEqualFunc)bnet_nicks_equal, NULL, (GDestroyNotify)bnet_buddy_free); Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 8 Jan 2005 06:00:06 -0000 1.4 --- Makefile.am 8 Jan 2005 07:21:12 -0000 1.5 *************** *** 1,4 **** --- 1,5 ---- EXTRA_DIST = \ bnet.h \ + buddy.h \ intl.h \ proto.h *************** *** 14,17 **** --- 15,19 ---- libbnet_la_SOURCES = \ bnet.c \ + buddy.c \ proto.c *************** *** 19,24 **** --- 21,28 ---- AM_CPPFLAGS = \ + -DVERSION=\"$(VERSION)\" \ -DLIBDIR=\"$(libdir)/gaim/\" \ -DDATADIR=\"$(datadir)\" \ + -DLOCALEDIR=\"$(GAIM_DATADIR)/locale\" \ $(GLIB_CFLAGS) \ $(GAIM_CFLAGS) \ Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bnet.h 8 Jan 2005 06:23:25 -0000 1.4 --- bnet.h 8 Jan 2005 07:21:12 -0000 1.5 *************** *** 45,48 **** --- 45,50 ---- #include <roomlist.h> + #include "buddy.h" + typedef enum { CS_SOCK = 1, --- NEW FILE: buddy.h --- /* * @file bnet.h * * gaim-bnet Protocol Plugin * * Copyright (C) 2004 by folks in AUTHORS file * * 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 * * $Id: buddy.h,v 1.1 2005/01/08 07:21:12 amc_grim Exp $ */ #ifndef BNET_BUDDY_H #define BNET_BUDDY_H #include "bnet.h" typedef struct _BNetUser BNetUser; typedef struct _BNetBuddy BNetBuddy; struct _BNetUser { gchar* nick; gchar* game; gchar* flags; }; struct _BNetBuddy { gchar* name; gboolean online; gchar* flags; gchar* location; }; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* Nick API */ guint bnet_nick_get_hash(const gchar *nick); gboolean bnet_nicks_equal(const gchar *nick1, const gchar *nick2); /* User API */ BNetUser *bnet_user_new(const gchar *nick, const gchar *game, const gchar *flags); void bnet_user_free(BNetUser *user); /* Buddy API */ BNetBuddy *bnet_buddy_new(const gchar *name); void bnet_buddy_free(BNetBuddy *buddy); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* BNET_BUDDY_H */ --- NEW FILE: buddy.c --- /* * gaim-bnet Protocol Plugin * Copyright (C) 2004 by folks in AUTHORS file * * 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 * * $Id: buddy.c,v 1.1 2005/01/08 07:21:12 amc_grim Exp $ */ #include "buddy.h" /****************************************************************************** * Nick API *****************************************************************************/ guint bnet_nick_get_hash(const gchar *nick) { gchar *down; guint hash; down = g_utf8_strdown(nick, -1); hash = g_str_hash(down); g_free(down); return hash; } gboolean bnet_nicks_equal(const gchar *nick1, const gchar *nick2) { return (gaim_utf8_strcasecmp(nick1, nick2) == 0); } /****************************************************************************** * User API *****************************************************************************/ BNetUser * bnet_user_new(const gchar *nick, const gchar *game, const gchar *flags) { BNetUser *user; g_return_val_if_fail(nick, NULL); user = g_new0(BNetUser, 1); g_return_val_if_fail(user, NULL); user->nick = g_strdup(nick); if(game) user->game = g_strdup(game); if(flags) user->flags = g_strdup(flags); return user; } void bnet_user_free(BNetUser *user) { g_return_if_fail(user); g_free(user->nick); g_free(user->game); g_free(user->flags); g_free(user); user = NULL; } /****************************************************************************** * Buddy API *****************************************************************************/ BNetBuddy * bnet_buddy_new(const gchar *name) { BNetBuddy *buddy; g_return_val_if_fail(name, NULL); buddy = g_new0(BNetBuddy, 1); g_return_val_if_fail(buddy, NULL); buddy->name = g_strdup(name); return buddy; } void bnet_buddy_free(BNetBuddy *buddy) { g_return_if_fail(buddy); g_free(buddy->name); g_free(buddy->flags); g_free(buddy->location); g_free(buddy); buddy = NULL; } |
From: Gary K. <amc...@us...> - 2005-01-08 06:23:36
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5614 Modified Files: bnet.c bnet.h proto.h Log Message: symboles starting with __ are supposed to be reserved for the compiler, as such we should avoid using them. Also, a bunch of white space clean up.. Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** bnet.c 8 Jan 2005 06:03:48 -0000 1.12 --- bnet.c 8 Jan 2005 06:23:25 -0000 1.13 *************** *** 398,502 **** } ! static GaimPluginProtocolInfo prpl_info = ! { ! OPT_PROTO_PASSWORD_OPTIONAL, /* options */ ! NULL, /* user_splits */ ! NULL, /* protocol_options */ ! NO_BUDDY_ICONS, /* icon_spec */ ! bnet_icon, /* list_icon */ ! NULL, /* list_emblems */ ! NULL, /* status_text */ ! NULL, /* tooltip_text */ ! NULL, /* away_states */ ! NULL, /* blist_node_menu */ ! NULL, /* chat_info */ ! NULL, /* chat_info_defaults */ ! bnet_login, /* login */ ! bnet_close, /* close */ ! bnet_send_im, /* send_im */ ! NULL, /* set_info */ ! NULL, /* send_typing */ ! NULL, /* get_info */ ! NULL, /* set_away */ ! NULL, /* set_idle */ ! NULL, /* change_password */ ! bnet_add_buddy, /* add_buddy */ ! NULL, /* add_buddies */ ! bnet_remove_buddy, /* remove_buddy */ ! NULL, /* remove_buddies */ ! NULL, /* add_permit */ ! NULL, /* add_deny */ ! NULL, /* rem_permit */ ! NULL, /* rem_deny */ ! NULL, /* set_permit_deny */ ! NULL, /* warn */ ! NULL, /* join_chat */ ! NULL, /* reject_chat */ ! NULL, /* chat_invite */ ! NULL, /* chat_leave */ ! NULL, /* chat_whisper */ ! NULL, /* chat_send */ ! NULL, /* keepalive */ ! NULL, /* register_user */ ! NULL, /* get_cb_info */ ! NULL, /* get_cb_away */ ! NULL, /* alias_buddy */ ! NULL, /* group_buddy */ ! NULL, /* rename_group */ ! NULL, /* buddy_free */ ! NULL, /* convo_closed */ ! NULL, /* normalize */ ! NULL, /* set_buddy_icon */ ! NULL, /* remove_group */ ! NULL, /* get_cb_real_name */ ! NULL, /* set_chat_topic */ ! NULL, /* find_blist_chat */ ! NULL, /* roomlist_get_list*/ ! NULL, /* roomlist_cancel */ ! NULL, /* roomlist_expand_catagory */ ! NULL, /* can_receive_file */ ! NULL /* send_file */ }; ! static GaimPluginInfo info = ! { ! GAIM_PLUGIN_MAGIC, ! GAIM_MAJOR_VERSION, ! GAIM_MINOR_VERSION, ! GAIM_PLUGIN_PROTOCOL, /* type */ ! NULL, /* ui_requirement */ ! 0, /* flags */ ! NULL, /* dependencies */ ! GAIM_PRIORITY_DEFAULT, /* priority */ ! "prpl-bnet", /* id */ ! "Battle.net", /* name */ ! VERSION, /* version */ ! N_("Battle.net Protocol Plugin"), /* summary */ ! N_("Allows Gaim to send messages over Battle.net."), /* description */ ! "Don Seiler <do...@se...>", /* author */ ! BNET_WEBSITE, /* homepage */ ! NULL, /* load */ ! NULL, /* unload */ ! NULL, /* destroy */ ! NULL, /* ui_info */ ! &prpl_info, /* extra_info */ ! NULL, /* prefs_info */ ! bnet_actions /* actions */ }; ! static void _init_plugin(GaimPlugin *plugin) ! { ! GaimAccountOption *option; ! option = gaim_account_option_string_new(_("Server"), "server", BNET_DEFAULT_SERVER); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! option = gaim_account_option_int_new(_("Port"), "port", BNET_DEFAULT_PORT); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! /* Not needed until *clear-text* protocol is used ! option = gaim_account_option_string_new(_("CD-Key"), "cdkey", ""); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);*/ ! _bnet_plugin = plugin; }; --- 398,509 ---- } ! static GaimPluginProtocolInfo prpl_info = { ! OPT_PROTO_PASSWORD_OPTIONAL, /* options */ ! NULL, /* user_splits */ ! NULL, /* protocol_options */ ! NO_BUDDY_ICONS, /* icon_spec */ ! bnet_icon, /* list_icon */ ! NULL, /* list_emblems */ ! NULL, /* status_text */ ! NULL, /* tooltip_text */ ! NULL, /* away_states */ ! NULL, /* blist_node_menu */ ! NULL, /* chat_info */ ! NULL, /* chat_info_defaults */ ! bnet_login, /* login */ ! bnet_close, /* close */ ! bnet_send_im, /* send_im */ ! NULL, /* set_info */ ! NULL, /* send_typing */ ! NULL, /* get_info */ ! NULL, /* set_away */ ! NULL, /* set_idle */ ! NULL, /* change_password */ ! bnet_add_buddy, /* add_buddy */ ! NULL, /* add_buddies */ ! bnet_remove_buddy, /* remove_buddy */ ! NULL, /* remove_buddies */ ! NULL, /* add_permit */ ! NULL, /* add_deny */ ! NULL, /* rem_permit */ ! NULL, /* rem_deny */ ! NULL, /* set_permit_deny */ ! NULL, /* warn */ ! NULL, /* join_chat */ ! NULL, /* reject_chat */ ! NULL, /* chat_invite */ ! NULL, /* chat_leave */ ! NULL, /* chat_whisper */ ! NULL, /* chat_send */ ! NULL, /* keepalive */ ! NULL, /* register_user */ ! NULL, /* get_cb_info */ ! NULL, /* get_cb_away */ ! NULL, /* alias_buddy */ ! NULL, /* group_buddy */ ! NULL, /* rename_group */ ! NULL, /* buddy_free */ ! NULL, /* convo_closed */ ! NULL, /* normalize */ ! NULL, /* set_buddy_icon */ ! NULL, /* remove_group */ ! NULL, /* get_cb_real_name */ ! NULL, /* set_chat_topic */ ! NULL, /* find_blist_chat */ ! NULL, /* roomlist_get_list */ ! NULL, /* roomlist_cancel */ ! NULL, /* roomlist_expand_catagory */ ! NULL, /* can_receive_file */ ! NULL /* send_file */ }; ! static GaimPluginInfo info = { ! GAIM_PLUGIN_MAGIC, ! GAIM_MAJOR_VERSION, ! GAIM_MINOR_VERSION, ! GAIM_PLUGIN_PROTOCOL, /* type */ ! NULL, /* ui_requirement */ ! 0, /* flags */ ! NULL, /* dependencies */ ! GAIM_PRIORITY_DEFAULT, /* priority */ ! "prpl-bnet", /* id */ ! NULL, /* name */ ! VERSION, /* version */ ! NULL, /* summary */ ! NULL, /* description */ ! "Don Seiler <do...@se...>", /* author */ ! BNET_WEBSITE, /* homepage */ ! NULL, /* load */ ! NULL, /* unload */ ! NULL, /* destroy */ ! NULL, /* ui_info */ ! &prpl_info, /* extra_info */ ! NULL, /* prefs_info */ ! bnet_actions /* actions */ }; ! static void ! _init_plugin(GaimPlugin *plugin) { ! #ifdef ENABLE_NLS ! bindtextdomain(BNET_PACKAGE, LOCALEDIR); ! bind_textdomain_codeset(BNET_PACKAGE, "UTF-8"); ! #endif /* ENABLE_NLS */ ! info.name = _("Battle.net"); ! info.summary = _("Battle.net Protocol Plugin"); ! info.description = _("Allows Gaim to send messages over Battle.net."); ! GaimAccountOption *option; ! option = gaim_account_option_string_new(_("Server"), "server", BNET_DEFAULT_SERVER); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! option = gaim_account_option_int_new(_("Port"), "port", BNET_DEFAULT_PORT); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! ! /* Not needed until *clear-text* protocol is used ! option = gaim_account_option_string_new(_("CD-Key"), "cdkey", ""); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);*/ ! ! _bnet_plugin = plugin; }; Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bnet.h 8 Jan 2005 06:00:06 -0000 1.3 --- bnet.h 8 Jan 2005 06:23:25 -0000 1.4 *************** *** 23,28 **** */ ! #ifndef __BNET_H__ ! #define __BNET_H__ #define GAIM_PLUGINS --- 23,28 ---- */ ! #ifndef BNET_H ! #define BNET_H #define GAIM_PLUGINS *************** *** 91,93 **** void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name); ! #endif /* __BNET_H__ */ --- 91,93 ---- void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name); ! #endif /* BNET_H */ Index: proto.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** proto.h 7 Jan 2005 17:00:11 -0000 1.1 --- proto.h 8 Jan 2005 06:23:25 -0000 1.2 *************** *** 23,30 **** */ ! #ifndef __PROTO_H__ ! #define __PROTO_H__ void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg); ! #endif /* __PROTO_H__ */ --- 23,30 ---- */ ! #ifndef PROTO_H ! #define PROTO_H void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg); ! #endif /* PROTO_H */ |
From: Gary K. <amc...@us...> - 2005-01-08 06:03:57
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32642/src Modified Files: bnet.c Log Message: whoops Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** bnet.c 8 Jan 2005 06:00:06 -0000 1.11 --- bnet.c 8 Jan 2005 06:03:48 -0000 1.12 *************** *** 471,475 **** "prpl-bnet", /* id */ "Battle.net", /* name */ ! BNET_VERSION, /* version */ N_("Battle.net Protocol Plugin"), /* summary */ N_("Allows Gaim to send messages over Battle.net."), /* description */ --- 471,475 ---- "prpl-bnet", /* id */ "Battle.net", /* name */ ! VERSION, /* version */ N_("Battle.net Protocol Plugin"), /* summary */ N_("Allows Gaim to send messages over Battle.net."), /* description */ |
From: Gary K. <amc...@us...> - 2005-01-08 06:00:18
|
Update of /cvsroot/gaim-bnet/gaim-bnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31560 Modified Files: .cvsignore Makefile.am autogen.sh configure.ac Added Files: VERSION.in setup-gettext Log Message: A great big commit to make our build system sane. Well as sane as it's going to get... Index: .cvsignore =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 8 Jan 2005 04:37:50 -0000 1.3 --- .cvsignore 8 Jan 2005 06:00:04 -0000 1.4 *************** *** 1,2 **** --- 1,3 ---- + ABOUT-NLS Makefile Makefile.in *************** *** 15,18 **** --- 16,20 ---- libtool ltmain.sh + m4 missing mkinstalldirs Index: configure.ac =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/configure.ac,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure.ac 8 Jan 2005 04:37:03 -0000 1.2 --- configure.ac 8 Jan 2005 06:00:04 -0000 1.3 *************** *** 4,13 **** # ! AC_INIT(src/bnet.c) AC_PREREQ([2.50]) ! BNET_VERSION="`cat ./VERSION`" ! AM_INIT_AUTOMAKE([gaim-bnet], $BNET_VERSION, 'no-define') ! AC_DEFINE_UNQUOTED(BNET_VERSION, "$BNET_VERSION", [Gaim-BNET Version]) # --- 4,20 ---- # ! AC_INIT([gaim-bnet], [0.1.0cvs], [gai...@li...]) ! AC_CANONICAL_SYSTEM ! AM_CONFIG_HEADER(pre_config.h) ! ! AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) ! AC_PREREQ([2.50]) ! # ! # disable building a static lib ! # ! AC_DISABLE_STATIC ! # *************** *** 18,35 **** export PKG_CONFIG_PATH AC_PATH_PROG(sedpath, sed) # # Our header # - AH_TOP([ /* our header */ ! #ifndef _BNET_CONFIG_H ! #define _BNET_CONFIG_H ]) AH_BOTTOM([ ! #endif /* _BNET_CONFIG_H */ ]) # # Look for the C compiler # --- 25,57 ---- export PKG_CONFIG_PATH + # + # Make sure we have sed, eventhough just about everyone has it.. + # AC_PATH_PROG(sedpath, sed) + # # Our header # AH_TOP([ /* our header */ ! #ifndef BNET_CONFIG_H ! #define BNET_CONFIG_H ]) AH_BOTTOM([ ! #endif /* BNET_CONFIG_H */ ]) # + # Add a few convience defines to our header + # + AC_DEFINE_UNQUOTED(BNET_WEBSITE, "http://gaim-bnet.sourceforge.net", [Gaim-BNET Website]) + + # + # gettext + # + ALL_LINGUAS="" + AM_GNU_GETTEXT_VERSION(0.10.40) + AM_GNU_GETTEXT + + # # Look for the C compiler # *************** *** 86,94 **** # # Finish up # - AM_CONFIG_HEADER(pre_config.h) AC_OUTPUT([Makefile pixmaps/Makefile src/Makefile ]) --- 108,132 ---- # + # Version stuff + # + AC_CONFIG_COMMANDS_PRE([ + if test -e VERSION; then + cp -p VERSION VERSION.ac-save + fi + ]) + + AC_CONFIG_COMMANDS_POST([ + cmp VERSION VERSION.ac-save || touch -r VERSION.ac-save VERSION + rm -f VERSION.ac-save + ]) + + # # Finish up # AC_OUTPUT([Makefile + VERSION + intl/Makefile pixmaps/Makefile + po/Makefile.in src/Makefile ]) Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.am 28 Jul 2004 03:08:20 -0000 1.1.1.1 --- Makefile.am 8 Jan 2005 06:00:04 -0000 1.2 *************** *** 6,13 **** PROTOCOL \ README \ ! VERSION ! #SUBDIRS = src pixmaps ! SUBDIRS = src BUILT_SOURCES = bnet_config.h --- 6,13 ---- PROTOCOL \ README \ ! VERSION \ ! po/ChangeLog ! SUBDIRS = intl po src BUILT_SOURCES = bnet_config.h *************** *** 16,18 **** --- 16,21 ---- bnet_config.h: pre_config.h + cp -f po/Makefile po/.tmp-Makefile + sed -e "s#localedir = .*#localedir = $(GAIM_DATADIR)/locale#g" < po/.tmp-Makefile > po/Makefile + rm -f po/.tmp-Makefile $(sedpath) 's/#define PACKAGE/#define BNET_PACKAGE/g' pre_config.h > $@ --- NEW FILE: setup-gettext --- #!/bin/sh # # setup-gettext - Provides compatibility with versions of gettext # from the 0.10.x, 0.11.x, and 0.12.x series. # # Copyright (C) 2002 Christian Hammond. # # 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 # VERSION=0.1.6 VERBOSE=0 parse_gettext_version() { GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'` GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'` GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'` GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'` } find_gettext() { GETTEXT_TOOL=autopoint (autopoint --version) < /dev/null > /dev/null 2>&1 || { GETTEXT_TOOL=gettextize (gettextize --version) < /dev/null > /dev/null 2>&1 || { GETTEXT_TOOL= } } } install() { [ -f configure.in ] && { cp configure.in .tmp-configure.in sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in rm .tmp-configure.in } [ -f configure.ac ] && { cp configure.ac .tmp-configure.ac sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac rm .tmp-configure.ac } [ -f autogen.sh ] && { cp autogen.sh .tmp-autogen.sh sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -e 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh rm .tmp-autogen.sh } echo 'dnl Added by setup-gettext. Do not remove this' >> acinclude.m4 echo 'dnl unless you know what you are doing.' >> acinclude.m4 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4 } backup_m4() { [ -d m4 ] && mv m4 m4~ } restore_m4() { [ -d m4~ ] && { rm -rf m4 mv m4~ m4 } } restore_files() { [ -f configure.in~ ] && mv -f configure.in~ configure.in [ -f configure.ac~ ] && mv -f configure.ac~ configure.ac [ -f Makefile.am~ ] && mv -f Makefile.am~ Makefile.am } abort() { restore_files restore_m4 exit 1 } # Main code find_gettext # See if a version of gettext and its tools are installed. if test x$GETTEXT_TOOL = x; then echo echo "You do not have a version of gettext installed." echo "Please download one from your local package repository or" echo "from ftp://ftp.gnu.org/pub/gnu/gettext/" echo exit 1 fi parse_gettext_version NUMVAR=$# if test $NUMVAR -gt 0; then if test $NUMVAR -gt 1; then echo "Only one option at a time!" exit 1 elif test $1 = "--gettext-tool"; then echo $GETTEXT_TOOL exit 0 elif test $1 = "--help"; then echo "setup-gettext v$VERSION" echo "Usage:" echo " --gettext-tool Returns gettextize or autopoint, depending" echo " on the version of gettext installed." echo " --gettext-version Returns the version of gettext installed." echo " --gettext-major-version Returns the major version of gettext installed." echo " --gettext-minor-version Returns the minor version of gettext installed." echo " --gettext-micro-version Returns the micro version of gettext installed." echo " --help Displays this help screen." echo exit 0 elif test $1 = "--version"; then echo $VERSION exit 0 elif test $1 = "--gettext-version"; then echo $GETTEXT_VERSION exit 0 elif test $1 = "--gettext-major-version"; then echo $GETTEXT_MAJOR_VERSION exit 0 elif test $1 = "--gettext-minor-version"; then echo $GETTEXT_MINOR_VERSION exit 0 elif test $1 = "--gettext-micro-version"; then echo $GETTEXT_MICRO_VERSION exit 0 elif test $1 = "--install"; then install echo "setup-gettext installed." exit 0 elif test $1 = "--happy-url"; then echo http://gaim.sf.net/forkgettext.jpg exit 0 elif test $1 = "--verbose"; then VERBOSE=1 else echo "Invalid option '$1'" exit 1 fi fi # Okay, run the main stuff if test "$GETTEXT_TOOL" = "autopoint"; then backup_m4 [ $VERBOSE -eq 1 ] && echo " autopoint --force" echo n | autopoint --force || abort restore_m4 if test $GETTEXT_MINOR_VERSION -ge 12; then cp po/Makefile.in.in po/.tmp-Makefile.in.in sed -e 's#echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in rm po/.tmp-Makefile.in.in fi else if test $GETTEXT_MINOR_VERSION -eq 11; then backup_m4 # Gettext is pure evil. It DEMANDS that we press Return no matter # what. This gets rid of their happy "feature" of doom. [ $VERBOSE -eq 1 ] && \ echo " gettextize --copy --force --intl --no-changelog" sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize chmod +x .temp-gettextize echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort rm .temp-gettextize restore_files restore_m4 [ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars else [ $VERBOSE -eq 1 ] && echo " gettextize --copy --force" echo n | gettextize --copy --force || exit; fi fi --- NEW FILE: VERSION.in --- @VERSION@ Index: autogen.sh =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/autogen.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** autogen.sh 28 Jul 2004 03:08:20 -0000 1.1.1.1 --- autogen.sh 8 Jan 2005 06:00:04 -0000 1.2 *************** *** 1,6 **** --- 1,49 ---- #! /bin/sh + SETUP_GETTEXT=./setup-gettext + + ($SETUP_GETTEXT --gettext-tool) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have gettext installed to compile Guifications"; + echo; + exit; + } + + (libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have libtool installed to compile Guifications"; + echo; + exit; + } + + (automake --version) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have automake installed to compile Guifications"; + echo; + exit; + } + + (autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo; + echo "You must have autoconf installed to compile Guifications"; + echo; + exit; + } + echo "Generating configuration files for gaim-bnet, please wait...." echo; + # Backup po/ChangeLog because gettext likes to change it + if test -f 'po/ChangeLog'; then + cp -p po/ChangeLog po/ChangeLog.save + fi + + echo "Running gettextize, please ignore non-fatal messages...." + $SETUP_GETTEXT + + # Restore po/ChangeLog + if test -f 'po/ChangeLog.save'; then + mv po/ChangeLog.save po/ChangeLog + fi + echo "Running libtoolize, please ignore non-fatal messages...." echo n | libtoolize --copy --force || exit; |
From: Gary K. <amc...@us...> - 2005-01-08 06:00:16
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31560/src Modified Files: .cvsignore Makefile.am bnet.c bnet.h proto.c Added Files: intl.h Log Message: A great big commit to make our build system sane. Well as sane as it's going to get... Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** bnet.c 7 Jan 2005 22:21:16 -0000 1.10 --- bnet.c 8 Jan 2005 06:00:06 -0000 1.11 *************** *** 29,39 **** #define _GNU_SOURCE #include "bnet.h" #include "proto.h" - #include "request.h" - - #define BNET_WEBSITE "http://gaim-bnet.sourceforge.net" - #define BNET_DEFAULT_SERVER "europe.battle.net" #define BNET_DEFAULT_PORT 6112 --- 29,38 ---- #define _GNU_SOURCE + #include <request.h> + #include "bnet.h" + #include "intl.h" #include "proto.h" #define BNET_DEFAULT_SERVER "europe.battle.net" #define BNET_DEFAULT_PORT 6112 Index: .cvsignore =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/.cvsignore,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** .cvsignore 28 Jul 2004 03:08:20 -0000 1.1.1.1 --- .cvsignore 8 Jan 2005 06:00:06 -0000 1.2 *************** *** 7,9 **** --- 7,10 ---- *.la *.lib + *.loT *.dll Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.am 8 Jan 2005 04:41:37 -0000 1.3 --- Makefile.am 8 Jan 2005 06:00:06 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- EXTRA_DIST = \ bnet.h \ + intl.h \ proto.h --- NEW FILE: intl.h --- /* * gaim-bnet Protocol Plugin * Copyright (C) 2004-2005 by the folks in the AUTHORS file * * 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 BNET_INTL_H #define BNET_INTL_H #ifdef HAVE_CONFIG_H # include "../bnet_config.h" #endif /* HAVE_CONFIG_H */ #ifdef ENABLE_NLS # include <locale.h> # include <libintl.h> # define _(x) dgettext(BNET_PACKAGE, x) # ifdef dgettext_noop # define N_(String) dgettext_noop (BNET_PACKAGE, String) # else # define N_(String) (String) # endif #else # include <locale.h> # define N_(String) (String) # define _(x) (x) # define ngettext(Singular, Plural, Number) ((Number == 1) ? (Singular) : (Plural)) #endif /* ENABLE_NLS */ #endif /* BNET_INTL_H */ Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bnet.h 7 Jan 2005 22:21:17 -0000 1.2 --- bnet.h 8 Jan 2005 06:00:06 -0000 1.3 *************** *** 26,43 **** #define __BNET_H__ ! #include "internal.h" ! #include "plugin.h" ! #include "accountopt.h" ! #include "prpl.h" ! #include "conversation.h" ! #include "notify.h" ! #include "debug.h" ! #include "blist.h" ! #include "util.h" ! #include "gaim.h" ! #include "version.h" ! #include "roomlist.h" typedef enum { --- 26,47 ---- #define __BNET_H__ ! #define GAIM_PLUGINS ! #include <string.h> ! #include <sys/socket.h> ! #include <sys/types.h> ! #include <unistd.h> ! #include <plugin.h> ! #include <accountopt.h> ! #include <prpl.h> ! #include <conversation.h> ! #include <notify.h> ! #include <debug.h> ! #include <blist.h> ! #include <util.h> ! #include <gaim.h> ! #include <version.h> ! #include <roomlist.h> typedef enum { *************** *** 47,53 **** CS_VRFY, CS_CONN, - #define CS_LAST CS_CONN } bnet_conn_state; struct bnet_user { gchar* nick; --- 51,58 ---- CS_VRFY, CS_CONN, } bnet_conn_state; + #define CS_LAST CS_CONN + struct bnet_user { gchar* nick; Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** proto.c 7 Jan 2005 22:21:17 -0000 1.2 --- proto.c 8 Jan 2005 06:00:06 -0000 1.3 *************** *** 27,30 **** --- 27,32 ---- #endif + #include <string.h> + #include "bnet.h" |
From: Gary K. <amc...@us...> - 2005-01-08 06:00:15
|
Update of /cvsroot/gaim-bnet/gaim-bnet/po In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31560/po Added Files: .cvsignore ChangeLog POTFILES.in Log Message: A great big commit to make our build system sane. Well as sane as it's going to get... --- NEW FILE: .cvsignore --- ChangeLog.save Makefile Makefile.in Makefile.in.in POTFILES POTFILES.in.missing POTFILES.in.noi18n Rules-quot cat-id-tbl.c Makevars *.gmo *.mo *.pot *.sed *.header *.sin --- NEW FILE: POTFILES.in --- src/bnet.c src/proto.c --- NEW FILE: ChangeLog --- |
From: Gary K. <amc...@us...> - 2005-01-08 06:00:14
|
Update of /cvsroot/gaim-bnet/gaim-bnet/intl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31560/intl Added Files: .cvsignore Log Message: A great big commit to make our build system sane. Well as sane as it's going to get... --- NEW FILE: .cvsignore --- Makefile po2tbl.sed ChangeLog Makefile.in VERSION bindtextdom.c config.charset dcgettext.c dcigettext.c dcngettext.c dgettext.c dngettext.c eval-plural.h explodename.c finddomain.c gettext.c gettext.h gettextP.h gmo.h hash-string.h intl-compat.c l10nflist.c libgettext.h libgnuintl.h loadinfo.h loadmsgcat.c localcharset.c locale.alias localealias.c localename.c ngettext.c os2compat.c os2compat.h osdep.c plural.y plural-exp.c plural-exp.h ref-add.sin ref-del.sin textdomain.c cat-compat.c linux-msg.sed po2tbl.sed.in xopen-msg.sed plural.c charset.alias libintl.h ref-add.sed ref-del.sed |
From: Gary K. <amc...@us...> - 2005-01-08 05:08:12
|
Update of /cvsroot/gaim-bnet/gaim-bnet/intl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18571/intl Log Message: Directory /cvsroot/gaim-bnet/gaim-bnet/intl added to the repository |
From: Gary K. <amc...@us...> - 2005-01-08 05:03:37
|
Update of /cvsroot/gaim-bnet/gaim-bnet/po In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17831/po Log Message: Directory /cvsroot/gaim-bnet/gaim-bnet/po added to the repository |
From: Gary K. <amc...@us...> - 2005-01-08 04:41:52
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14162/src Modified Files: Makefile.am Log Message: nit picking.. Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile.am 7 Jan 2005 17:00:10 -0000 1.2 --- Makefile.am 8 Jan 2005 04:41:37 -0000 1.3 *************** *** 1,2 **** --- 1,6 ---- + EXTRA_DIST = \ + bnet.h \ + proto.h + plugindir = $(libdir)/gaim *************** *** 7,11 **** plugin_LTLIBRARIES = libbnet.la ! libbnet_la_SOURCES = bnet.c proto.c endif --- 11,17 ---- plugin_LTLIBRARIES = libbnet.la ! libbnet_la_SOURCES = \ ! bnet.c \ ! proto.c endif |
From: Gary K. <amc...@us...> - 2005-01-08 04:38:00
|
Update of /cvsroot/gaim-bnet/gaim-bnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13414 Modified Files: .cvsignore Log Message: tweaks Index: .cvsignore =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 28 Jul 2004 16:18:23 -0000 1.2 --- .cvsignore 8 Jan 2005 04:37:50 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- config.sub configure + depcomp pre_config.h pre_config.h.in *************** *** 16,17 **** --- 17,20 ---- missing mkinstalldirs + stamp-h1 + |
From: Gary K. <amc...@us...> - 2005-01-08 04:37:12
|
Update of /cvsroot/gaim-bnet/gaim-bnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13231 Modified Files: configure.ac Log Message: Minor annoyance.. Index: configure.ac =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/configure.ac,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** configure.ac 28 Jul 2004 03:08:20 -0000 1.1.1.1 --- configure.ac 8 Jan 2005 04:37:03 -0000 1.2 *************** *** 11,14 **** --- 11,21 ---- AC_DEFINE_UNQUOTED(BNET_VERSION, "$BNET_VERSION", [Gaim-BNET Version]) + # + # add this so i don't have to export PKG_CONFIG_PATH before running + # autogen/configure + # + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:$HOME/lib/pkgconfig" + export PKG_CONFIG_PATH + AC_PATH_PROG(sedpath, sed) # |
From: Don S. <ri...@us...> - 2005-01-07 22:36:34
|
Update of /cvsroot/gaim-bnet/gaim-bnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv909 Modified Files: AUTHORS Log Message: Adding Dario Index: AUTHORS =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/AUTHORS,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AUTHORS 28 Jul 2004 15:15:31 -0000 1.2 --- AUTHORS 7 Jan 2005 22:36:23 -0000 1.3 *************** *** 1,4 **** ! Authors ! ======= ! Don Seiler <do...@se...> Gary Kramlich --- 1,12 ---- ! gaim-bnet - Battle.net protocol plugin for Gaim ! ! IRC: #gaim-bnet on irc.freenode.net ! ! Developers ! ---------- ! Dario 'evew' Zilocchi ! Don 'rizzo' Seiler <do...@NO...> ! ! Mentor ! ------ Gary Kramlich |
From: Don S. <ri...@us...> - 2005-01-07 22:21:31
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30560/src Modified Files: bnet.c bnet.h proto.c Log Message: Some more functionality from evew, including raw message sender Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** bnet.c 7 Jan 2005 21:16:14 -0000 1.9 --- bnet.c 7 Jan 2005 22:21:16 -0000 1.10 *************** *** 32,35 **** --- 32,37 ---- #include "proto.h" + #include "request.h" + #define BNET_WEBSITE "http://gaim-bnet.sourceforge.net" *************** *** 37,40 **** --- 39,44 ---- #define BNET_DEFAULT_PORT 6112 + #define BNET_DEFAULT_GROUP_NAME "BNet" + #define BNET_INITIAL_BUFSIZE 1024 *************** *** 130,133 **** --- 134,176 ---- } + void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name) + { + GaimBuddy *b = gaim_buddy_new(bnet->account, name, NULL); + GaimGroup *g = gaim_find_group(BNET_DEFAULT_GROUP_NAME); + + if (!g) { + g = gaim_group_new(BNET_DEFAULT_GROUP_NAME); + gaim_blist_add_group(g, NULL); + } + + /*b->present = present; + b->idle = idle; + b->uc = state;*/ + + gaim_blist_add_buddy(b, NULL, g, NULL); + } + + + void bnet_req_friends_list(struct bnet_conn* bnet) + { + bnet_sock_send(bnet, "/f l\n"); + } + + ///////////////////////////////////////////////// + + static void bnet_raw_request_cb(GaimConnection *gc, char *msg) + { + struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; + + if (g_list_find(gaim_connections_get_all(), gc)) { + + gaim_debug_info("bnet", + "bnet_raw_request_cb: sending raw message - \"%s\"\n", + msg); + + bnet_sock_send(bnet, "%s\n", msg); + } + } + ///////////////////////////////////////////////// *************** *** 146,158 **** args[1] = what; ! /* ! * Just copied this from irc prpl. ! * No idea what NULL param is supposed to be ! */ ! // bnet_privmsg(bnet, "msg", NULL, args); return 1; }; - static const char *bnet_icon(GaimAccount *a, GaimBuddy *b) { --- 189,196 ---- args[1] = what; ! bnet_sock_send(bnet, "/w %s %s\n", who, what); return 1; }; static const char *bnet_icon(GaimAccount *a, GaimBuddy *b) { *************** *** 184,188 **** gaim_connection_set_state(gc, GAIM_CONNECTED); ! //bnet_req_friends_list(bnet); } else --- 222,226 ---- gaim_connection_set_state(gc, GAIM_CONNECTED); ! bnet_req_friends_list(bnet); } else *************** *** 218,223 **** bnet->inbuf[bnet->inbufused] = '\0'; ! /* We must switch between the two cases because in CS_USER and CS_PASS ! * state input is NOT line buffered */ if (bnet->state == CS_CONN || bnet->state == CS_VRFY) { cur = bnet->inbuf; --- 256,261 ---- bnet->inbuf[bnet->inbufused] = '\0'; ! /* We must switch between the two cases because in CS_USER and CS_PASS states ! * input is NOT line buffered */ if (bnet->state == CS_CONN || bnet->state == CS_VRFY) { cur = bnet->inbuf; *************** *** 315,329 **** }; ! static void bnet_add_buddy(GaimConnection *gc, GaimBuddy *b, GaimGroup *group) { gaim_debug_info("bnet", "bnet_add_buddy\n"); ! serv_got_update(gc, b->name, TRUE, 0, 0, 0, 0); }; ! static void bnet_remove_buddy(GaimConnection *gc, GaimBuddy *b, GaimGroup *group) { gaim_debug_info("bnet", "bnet_remove_buddy\n"); }; static GaimPluginProtocolInfo prpl_info = { --- 353,402 ---- }; ! static void bnet_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { + struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; + struct bnet_buddy *b = bnet_buddy_new(buddy->name); + gaim_debug_info("bnet", "bnet_add_buddy\n"); ! ! g_hash_table_insert(bnet->buddies, b->name, b); }; ! static void bnet_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { + struct bnet_conn *bnet = (struct bnet_conn*)gc->proto_data; + gaim_debug_info("bnet", "bnet_remove_buddy\n"); + + g_hash_table_remove(bnet->buddies, buddy->name); }; + static void bnet_send_raw_cmd(GaimPluginAction *action) + { + GaimConnection *gc = (GaimConnection*)action->context; + + gaim_debug_info("bnet", "bnet_send_raw_cmd\n"); + + gaim_request_input(gc, _("Send a raw command"), + _("Send a raw command to the server"), + _("Type here."), + NULL, FALSE, FALSE, NULL, + _("Send"), G_CALLBACK(bnet_raw_request_cb), + _("Cancel"), NULL, gc); + } + + static GList *bnet_actions(GaimPlugin *plugin, gpointer context) + { + //GaimConnection *gc = (GaimConnection*)context; + GList *m = NULL; + GaimPluginAction *act; + + act = gaim_plugin_action_new(_("Send raw command..."), + bnet_send_raw_cmd); + m = g_list_append(m, act); + + return m; + } + static GaimPluginProtocolInfo prpl_info = { *************** *** 387,391 **** }; - static GaimPluginInfo info = { --- 460,463 ---- *************** *** 411,418 **** &prpl_info, /* extra_info */ NULL, /* prefs_info */ ! NULL /* actions */ }; - static void _init_plugin(GaimPlugin *plugin) { --- 483,489 ---- &prpl_info, /* extra_info */ NULL, /* prefs_info */ ! bnet_actions /* actions */ }; static void _init_plugin(GaimPlugin *plugin) { Index: bnet.h =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bnet.h 7 Jan 2005 17:00:11 -0000 1.1 --- bnet.h 7 Jan 2005 22:21:17 -0000 1.2 *************** *** 84,86 **** --- 84,88 ---- }; + void bnet_add_default_buddy(struct bnet_conn* bnet, const gchar* name); + #endif /* __BNET_H__ */ Index: proto.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/proto.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** proto.c 7 Jan 2005 17:00:11 -0000 1.1 --- proto.c 7 Jan 2005 22:21:17 -0000 1.2 *************** *** 33,36 **** --- 33,38 ---- sizeof(_bnet_proto_proc_table[0])) + #define IS_NUM(c) ((c) >= '0' && (c) <= '9') + void bnet_proto_msg_user(struct bnet_conn* bnet, const gchar** args) { *************** *** 117,122 **** --- 119,149 ---- { const gchar* info = args[0]; + guint len = strlen(info); gaim_debug_info("bnet", "INFO %s\n", info); + + if (len > 4 && + ((info[1] == ':' && IS_NUM(info[0])) || + (info[2] == ':' && IS_NUM(info[0]) && IS_NUM(info[1])))) { + GaimConnection *gc = gaim_account_get_connection(bnet->account); + gchar *p, *nick, *state; + struct bnet_buddy* b; + + p = strchr(info,' '); + + sscanf(p, " %a[^,], %as", &nick, &state); + + b = g_hash_table_lookup(bnet->buddies, nick); + if (!b) + bnet_add_default_buddy(bnet, nick); + + if (!strcmp(state,"offline")) + serv_got_update(gc, nick, FALSE, 0, 0, 0, 0); + else + serv_got_update(gc, nick, TRUE, 0, 0, 0, 0); + + free(nick); + free(state); + } } *************** *** 158,162 **** { 1001, 3, bnet_proto_msg_user }, { 1002, 3, bnet_proto_msg_join }, ! { 1003, 3, bnet_proto_msg_leave }, { 1004, 3, bnet_proto_msg_whispearf }, { 1005, 3, bnet_proto_msg_talk }, --- 185,189 ---- { 1001, 3, bnet_proto_msg_user }, { 1002, 3, bnet_proto_msg_join }, ! { 1003, 2, bnet_proto_msg_leave }, { 1004, 3, bnet_proto_msg_whispearf }, { 1005, 3, bnet_proto_msg_talk }, *************** *** 177,181 **** gchar* args[PROTO_MAX_ARGS]; ! gaim_debug_info("bnet", "bnet_proto_process_msg\n"); for (i=0,l=0,b=0,e=strlen(msg); i<PROTO_MAX_ARGS; i++,l++,b=l) { --- 204,208 ---- gchar* args[PROTO_MAX_ARGS]; ! //gaim_debug_info("bnet", "bnet_proto_process_msg\n"); for (i=0,l=0,b=0,e=strlen(msg); i<PROTO_MAX_ARGS; i++,l++,b=l) { *************** *** 187,191 **** len = l-b; if (len > 0) { ! args[i] = g_memdup(msg+b,len+1); args[i][len] = 0; args_n++; --- 214,218 ---- len = l-b; if (len > 0) { ! args[i] = g_memdup(msg+b, len+1); args[i][len] = 0; args_n++; *************** *** 201,205 **** for (i = 0; i < PROTO_MSG_N; i++) { ! struct bnet_proto_proc_info* pi = _bnet_proto_proc_table + i; if (pi->id == id) { if (pi->args_n+2 != args_n) { --- 228,232 ---- for (i = 0; i < PROTO_MSG_N; i++) { ! struct bnet_proto_proc_info* pi = _bnet_proto_proc_table+i; if (pi->id == id) { if (pi->args_n+2 != args_n) { *************** *** 213,217 **** } ! for (i=0; i<PROTO_MAX_ARGS; i++) g_free(args[i]); } --- 240,244 ---- } ! for (i = 0; i < PROTO_MAX_ARGS; i++) g_free(args[i]); } |
From: Don S. <ri...@us...> - 2005-01-07 21:16:25
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14004/src Modified Files: bnet.c Log Message: Using proper name Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bnet.c 7 Jan 2005 17:38:17 -0000 1.8 --- bnet.c 7 Jan 2005 21:16:14 -0000 1.9 *************** *** 399,403 **** GAIM_PRIORITY_DEFAULT, /* priority */ "prpl-bnet", /* id */ ! "bnet", /* name */ BNET_VERSION, /* version */ N_("Battle.net Protocol Plugin"), /* summary */ --- 399,403 ---- GAIM_PRIORITY_DEFAULT, /* priority */ "prpl-bnet", /* id */ ! "Battle.net", /* name */ BNET_VERSION, /* version */ N_("Battle.net Protocol Plugin"), /* summary */ |
From: Don S. <ri...@us...> - 2005-01-07 17:38:40
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/src Modified Files: bnet.c Log Message: Names aren't really translatable. Not sure if my name belongs anymore, at least not _just_ my name. We can discuss later Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bnet.c 7 Jan 2005 17:00:10 -0000 1.7 --- bnet.c 7 Jan 2005 17:38:17 -0000 1.8 *************** *** 403,407 **** N_("Battle.net Protocol Plugin"), /* summary */ N_("Allows Gaim to send messages over Battle.net."), /* description */ ! N_("Don Seiler <do...@se...>"), /* author */ BNET_WEBSITE, /* homepage */ NULL, /* load */ --- 403,407 ---- N_("Battle.net Protocol Plugin"), /* summary */ N_("Allows Gaim to send messages over Battle.net."), /* description */ ! "Don Seiler <do...@se...>", /* author */ BNET_WEBSITE, /* homepage */ NULL, /* load */ |
From: Don S. <ri...@us...> - 2005-01-07 17:00:21
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18496/src Modified Files: Makefile.am bnet.c Added Files: bnet.h proto.c proto.h Log Message: Committing changes fro patch #1095862 Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bnet.c 18 Sep 2004 16:04:59 -0000 1.6 --- bnet.c 7 Jan 2005 17:00:10 -0000 1.7 *************** *** 1,3 **** - /* vim: set expandtab tabstop=4 shiftwidth=4: */ /* * @file bnet.c --- 1,2 ---- *************** *** 28,50 **** #endif ! #include "internal.h" ! ! #include "plugin.h" ! #include "accountopt.h" ! #include "prpl.h" ! #include "conversation.h" ! #include "notify.h" ! #include "debug.h" ! #include "blist.h" ! #include "util.h" ! #include "gaim.h" ! #include "version.h" ! #include "roomlist.h" #define BNET_WEBSITE "http://gaim-bnet.sourceforge.net" ! #define BNET_DEFAULT_SERVER "localhost" ! #define BNET_DEFAULT_PORT 415 #define BNET_INITIAL_BUFSIZE 1024 --- 27,39 ---- #endif ! #define _GNU_SOURCE ! #include "bnet.h" ! #include "proto.h" #define BNET_WEBSITE "http://gaim-bnet.sourceforge.net" ! #define BNET_DEFAULT_SERVER "europe.battle.net" ! #define BNET_DEFAULT_PORT 6112 #define BNET_INITIAL_BUFSIZE 1024 *************** *** 52,95 **** static GaimPlugin *_bnet_plugin = NULL; ! struct bnet_conn { ! GaimAccount *account; ! GHashTable *msgs; ! GHashTable *cmds; ! char *server; ! int fd; ! guint timer; ! GHashTable *buddies; ! char *inbuf; ! int inbuflen; ! int inbufused; ! GString *motd; ! GString *names; ! char *nameconv; ! struct _whois { ! char *nick; ! char *away; ! char *userhost; ! char *name; ! char *server; ! char *serverinfo; ! char *channels; ! int ircop; ! int identified; ! int idle; ! time_t signon; ! } whois; ! GaimRoomlist *roomlist; ! gboolean quitting; ! }; ! struct bnet_buddy { ! char *name; ! gboolean online; ! gboolean flag; ! }; static int bnet_send_im(GaimConnection *gc, --- 41,134 ---- static GaimPlugin *_bnet_plugin = NULL; ! ///////////////////////////////////////////////// ! guint bnet_nick_hash(const gchar* nick) ! { ! gchar* t; ! guint h; ! t = g_utf8_strdown(nick, -1); ! h = g_str_hash(t); ! g_free(t); ! return h; ! } ! gboolean bnet_nick_equal(const gchar* nick1, const gchar* nick2) ! { ! return gaim_utf8_strcasecmp(nick1, nick2) == 0; ! } + struct bnet_user* bnet_user_new(const gchar* nick, const gchar* game, const gchar* flags) + { + struct bnet_user* u; + + u = g_new0(struct bnet_user, 1); + u->nick = g_strdup(nick); + u->game = g_strdup(game); + u->flags = g_strdup(flags); + + return u; + } + + void bnet_user_free(struct bnet_user* u) + { + g_free(u->nick); + g_free(u->game); + g_free(u->flags); + g_free(u); + } + + struct bnet_buddy* bnet_buddy_new(const gchar* name) + { + struct bnet_buddy* bd = g_new0(struct bnet_buddy, 1); + + bd->name = g_strdup(name); + + return bd; + } + + void bnet_buddy_free(struct bnet_buddy* bud) + { + g_free(bud->name); + g_free(bud->flags); + g_free(bud->location); + g_free(bud); + } + + ///////////////////////////////////////////////// + + gint bnet_sock_send(struct bnet_conn* bnet, const gchar* fmt, ...) + { + va_list ap; + gchar* buf; + gint ret; + + va_start(ap, fmt); + vasprintf(&buf, fmt, ap); + va_end(ap); + ret = send(bnet->fd, buf, strlen(buf), 0); + free(buf); + + return ret; + } + + void bnet_connection_update_progress(struct bnet_conn* bnet, bnet_conn_state s) + { + static const gchar* status[] = { + N_("Connecting to server"), + N_("Sending username"), + N_("Sending password"), + N_("Waiting confirmation"), + N_("Connected") + }; + + bnet->state = s; + gaim_connection_update_progress( + gaim_account_get_connection(bnet->account), + _(status[bnet->state-1]), bnet->state, CS_LAST); + } + + ///////////////////////////////////////////////// static int bnet_send_im(GaimConnection *gc, *************** *** 111,115 **** * No idea what NULL param is supposed to be */ ! bnet_privmsg(bnet, "msg", NULL, args); return 1; }; --- 150,154 ---- * No idea what NULL param is supposed to be */ ! // bnet_privmsg(bnet, "msg", NULL, args); return 1; }; *************** *** 121,128 **** --- 160,273 ---- } + static void bnet_parse_msg(struct bnet_conn* bnet, const gchar* msg) + { + GaimConnection* gc = gaim_account_get_connection(bnet->account); + + switch (bnet->state) { + case CS_SOCK: // NR + break; + case CS_USER: + if (!strcmp(msg,"Username: ")) { + bnet_sock_send(bnet, "%s\n", bnet->user); + bnet_connection_update_progress(bnet, CS_PASS); + } + break; + case CS_PASS: + if (!strcmp(msg,"Password: ")) { + bnet_sock_send(bnet, "%s\n", bnet->pass); + bnet_connection_update_progress(bnet, CS_VRFY); + } + break; + case CS_VRFY: + if (!strstr(msg,"incorrect")) { + bnet_connection_update_progress(bnet, CS_CONN); + gaim_connection_set_state(gc, GAIM_CONNECTED); + + //bnet_req_friends_list(bnet); + } + else + bnet_connection_update_progress(bnet, CS_USER); + break; + case CS_CONN: + bnet_proto_process_msg(bnet, msg); + break; + } + } + + static void bnet_input_cb(gpointer data, gint source, GaimInputCondition cond) + { + GaimConnection* gc = data; + struct bnet_conn* bnet = gc->proto_data; + gchar *cur, *end; + gint len; + + if (bnet->inbuflen < bnet->inbufused + BNET_INITIAL_BUFSIZE) { + bnet->inbuflen += BNET_INITIAL_BUFSIZE; + bnet->inbuf = g_realloc(bnet->inbuf, bnet->inbuflen); + } + + if ((len = read(bnet->fd, bnet->inbuf + bnet->inbufused, BNET_INITIAL_BUFSIZE-1)) < 0) { + gaim_connection_error(gc, _("Read error")); + return; + } else if (len == 0) { + /* Remote closed the connection, probably */ + return; + } + + bnet->inbufused += len; + bnet->inbuf[bnet->inbufused] = '\0'; + + /* We must switch between the two cases because in CS_USER and CS_PASS + * state input is NOT line buffered */ + if (bnet->state == CS_CONN || bnet->state == CS_VRFY) { + cur = bnet->inbuf; + while (cur < bnet->inbuf + bnet->inbufused && + ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { + gint step = (*end == '\r' ? 2 : 1); + *end = '\0'; + if (cur != end) + bnet_parse_msg(bnet, cur); + cur = end + step; + } + if (cur != bnet->inbuf + bnet->inbufused) { /* leftover */ + bnet->inbufused -= (cur - bnet->inbuf); + memmove(bnet->inbuf, cur, bnet->inbufused); + } else { + bnet->inbufused = 0; + } + } + else { + bnet_parse_msg(bnet, bnet->inbuf); + bnet->inbufused = 0; + } + } + + static void bnet_login_cb(gpointer data, gint source, GaimInputCondition cond) + { + GaimConnection* gc = data; + struct bnet_conn* bnet = gc->proto_data; + GList* connections = gaim_connections_get_all(); + + if (source < 0) + return; + + if (!g_list_find(connections, gc)) { + close(source); + return; + } + + bnet->fd = source; + + gc->inpa = gaim_input_add(bnet->fd, GAIM_INPUT_READ, bnet_input_cb, gc); + + bnet_sock_send(bnet, "\003\004%s", bnet->user); + bnet_connection_update_progress(bnet, CS_USER); + } + static void bnet_login(GaimAccount *account) { GaimConnection *gc; struct bnet_conn *bnet; + gint err; gaim_debug_info("bnet", "bnet_login\n"); *************** *** 132,139 **** bnet->account = account; ! gaim_connection_set_state(gc, GAIM_CONNECTED); ! serv_finish_login(gc); ! }; static void bnet_close(GaimConnection *gc) --- 277,303 ---- bnet->account = account; ! bnet->user = gaim_account_get_username(account); ! bnet->pass = gc->account->password; ! ! bnet->users = g_hash_table_new_full( ! (GHashFunc)bnet_nick_hash, (GEqualFunc)bnet_nick_equal, ! NULL, (GDestroyNotify)bnet_user_free); ! bnet->buddies = g_hash_table_new_full( ! (GHashFunc)bnet_nick_hash, (GEqualFunc)bnet_nick_equal, ! NULL, (GDestroyNotify)bnet_buddy_free); + bnet_connection_update_progress(bnet, CS_SOCK); + + err = gaim_proxy_connect(account, + gaim_account_get_string(account, "server", BNET_DEFAULT_SERVER), + gaim_account_get_int(account, "port", BNET_DEFAULT_PORT), + bnet_login_cb, + gc); + + if (err || !account->gc) + gaim_connection_error(gc, _("Couldn't create socket")); + + //serv_finish_login(gc); + }; static void bnet_close(GaimConnection *gc) *************** *** 147,151 **** return; ! bnet_reset(gc, bnet); g_free(bnet); }; --- 311,315 ---- return; ! // bnet_reset(gc, bnet); g_free(bnet); }; *************** *** 260,265 **** prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! option = gaim_account_option_string_new(_("CD-Key"), "cdkey"); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); _bnet_plugin = plugin; --- 424,430 ---- prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); ! /* Not needed until *clear-text* protocol is used ! option = gaim_account_option_string_new(_("CD-Key"), "cdkey", ""); ! prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);*/ _bnet_plugin = plugin; --- NEW FILE: bnet.h --- /* * @file bnet.h * * gaim-bnet Protocol Plugin * * Copyright (C) 2004 by folks in AUTHORS file * * 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 * * $Id: bnet.h,v 1.1 2005/01/07 17:00:11 rizzo Exp $ */ #ifndef __BNET_H__ #define __BNET_H__ #include "internal.h" #include "plugin.h" #include "accountopt.h" #include "prpl.h" #include "conversation.h" #include "notify.h" #include "debug.h" #include "blist.h" #include "util.h" #include "gaim.h" #include "version.h" #include "roomlist.h" typedef enum { CS_SOCK = 1, CS_USER, CS_PASS, CS_VRFY, CS_CONN, #define CS_LAST CS_CONN } bnet_conn_state; struct bnet_user { gchar* nick; gchar* game; gchar* flags; }; struct bnet_buddy { gchar* name; gboolean online; gchar* flags; gchar* location; }; struct bnet_conn { GaimAccount* account; const gchar* user; const gchar* pass; bnet_conn_state state; gint fd; gchar* inbuf; guint inbuflen, inbufused; GSList* exp; gchar* chan; GHashTable* users; // known user (on chan) gchar* away; GHashTable* buddies; }; #endif /* __BNET_H__ */ --- NEW FILE: proto.c --- /* * @file proto.c * * gaim-bnet Protocol Plugin * * Copyright (C) 2004 by folks in AUTHORS file * * 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 * * $Id: proto.c,v 1.1 2005/01/07 17:00:11 rizzo Exp $ */ #ifdef HAVE_CONFIG_H # include "../bnet_config.h" #endif #include "bnet.h" #define PROTO_MAX_ARGS 5 #define PROTO_MSG_N (sizeof(_bnet_proto_proc_table) / \ sizeof(_bnet_proto_proc_table[0])) void bnet_proto_msg_user(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; const gchar* game = args[1]; const gchar* flags = args[2]; struct bnet_user* u; u = (struct bnet_user*)g_hash_table_lookup(bnet->users, nick); if (!u) { u = bnet_user_new(nick, game, flags); g_hash_table_insert(bnet->users, u->nick, u); } gaim_debug_info("bnet", "USER %02u users on chan now!\n", g_hash_table_size(bnet->users)); } void bnet_proto_msg_join(struct bnet_conn* bnet, const gchar** args) { // reasons to distinguish between JOIN and USER ? bnet_proto_msg_user(bnet, args); } void bnet_proto_msg_leave(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; //const gchar* flags = args[2]; g_hash_table_remove(bnet->users, nick); gaim_debug_info("bnet", "LEAVE %02u users on chan now!\n", g_hash_table_size(bnet->users)); } void bnet_proto_msg_whispearf(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; const gchar* msg = args[2]; gaim_debug_info("bnet", "WHISP FROM %s - %s\n", nick, msg); } void bnet_proto_msg_talk(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; const gchar* msg = args[2]; gaim_debug_info("bnet", "<%s>: %s\n", nick, msg); } void bnet_proto_msg_channel(struct bnet_conn* bnet, const gchar** args) { const gchar* chan = args[0]; if (bnet->chan) g_free(bnet->chan); bnet->chan = g_strdup(chan); gaim_debug_info("bnet", "CHAN %s\n", chan); } void bnet_proto_msg_userflg(struct bnet_conn* bnet, const gchar** args) { // useless and never seen gaim_debug_info("bnet", "USERFLG\n"); } void bnet_proto_msg_whispeart(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; const gchar* msg = args[2]; gaim_debug_info("bnet", "WHISP TO %s - %s\n", nick, msg); } void bnet_proto_msg_info(struct bnet_conn* bnet, const gchar** args) { const gchar* info = args[0]; gaim_debug_info("bnet", "INFO %s\n", info); } void bnet_proto_msg_error(struct bnet_conn* bnet, const gchar** args) { const gchar* error = args[0]; gaim_debug_info("bnet", "ERROR %s\n", error); } void bnet_proto_msg_emote(struct bnet_conn* bnet, const gchar** args) { const gchar* nick = args[0]; //const gchar* game = args[1]; const gchar* msg = args[2]; gaim_debug_info("bnet", "EMOTE FROM %s - %s\n", nick, msg); } void bnet_proto_msg_ping(struct bnet_conn* bnet, const gchar** args) { gaim_debug_info("bnet", "PING\n"); } void bnet_proto_msg_name(struct bnet_conn* bnet, const gchar** args) { const gchar* name = args[0]; gaim_debug_info("bnet", "NAME %s\n", name); } /////////////////////////////////////////////////////////////// struct bnet_proto_proc_info { guint id; guint args_n; void (*proc_func)(struct bnet_conn*, const gchar**); } _bnet_proto_proc_table[] = { { 1001, 3, bnet_proto_msg_user }, { 1002, 3, bnet_proto_msg_join }, { 1003, 3, bnet_proto_msg_leave }, { 1004, 3, bnet_proto_msg_whispearf }, { 1005, 3, bnet_proto_msg_talk }, { 1007, 1, bnet_proto_msg_channel }, { 1009, 2, bnet_proto_msg_userflg }, { 1010, 3, bnet_proto_msg_whispeart }, { 1018, 1, bnet_proto_msg_info }, { 1019, 1, bnet_proto_msg_error }, { 1023, 3, bnet_proto_msg_emote }, { 2000, 0, bnet_proto_msg_ping }, { 2010, 1, bnet_proto_msg_name } }; void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg) { guint id; gint i,l,b,e,len,args_n=0; gchar* args[PROTO_MAX_ARGS]; gaim_debug_info("bnet", "bnet_proto_process_msg\n"); for (i=0,l=0,b=0,e=strlen(msg); i<PROTO_MAX_ARGS; i++,l++,b=l) { if (msg[l]=='"') for (b=++l; l<e && msg[l]!='"'; l++); else for (; l<e && msg[l]!=' '; l++); len = l-b; if (len > 0) { args[i] = g_memdup(msg+b,len+1); args[i][len] = 0; args_n++; //gaim_debug_info("bnet", "args[%d] %s(%d)\n", i, args[i], len); } else { args[i] = 0; //gaim_debug_info("bnet", "args[%d] %s(%d)\n", i, args[i], 0); } } sscanf(args[0], "%04u", &id); for (i = 0; i < PROTO_MSG_N; i++) { struct bnet_proto_proc_info* pi = _bnet_proto_proc_table + i; if (pi->id == id) { if (pi->args_n+2 != args_n) { gaim_debug_info("bnet", "bnet_proto_process_msg: wrong args number\n"); } else { pi->proc_func(bnet, (const gchar**)args+2); } break; } } for (i=0; i<PROTO_MAX_ARGS; i++) g_free(args[i]); } Index: Makefile.am =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.am 28 Jul 2004 03:08:20 -0000 1.1.1.1 --- Makefile.am 7 Jan 2005 17:00:10 -0000 1.2 *************** *** 7,11 **** plugin_LTLIBRARIES = libbnet.la ! libbnet_la_SOURCES = bnet.c endif --- 7,11 ---- plugin_LTLIBRARIES = libbnet.la ! libbnet_la_SOURCES = bnet.c proto.c endif --- NEW FILE: proto.h --- /* * @file proto.h * * gaim-bnet Protocol Plugin * * Copyright (C) 2004 by folks in AUTHORS file * * 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 * * $Id: proto.h,v 1.1 2005/01/07 17:00:11 rizzo Exp $ */ #ifndef __PROTO_H__ #define __PROTO_H__ void bnet_proto_process_msg(struct bnet_conn* bnet, const gchar* msg); #endif /* __PROTO_H__ */ |
From: Don S. <ri...@us...> - 2004-09-18 16:05:10
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22176/src Modified Files: bnet.c Log Message: Changes for gaim-1.0.0 Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bnet.c 2 Sep 2004 19:15:52 -0000 1.5 --- bnet.c 18 Sep 2004 16:04:59 -0000 1.6 *************** *** 39,42 **** --- 39,43 ---- #include "util.h" #include "gaim.h" + #include "version.h" #include "roomlist.h" *************** *** 163,167 **** static GaimPluginProtocolInfo prpl_info = { - GAIM_PRPL_API_VERSION, /* API version */ OPT_PROTO_PASSWORD_OPTIONAL, /* options */ NULL, /* user_splits */ --- 164,167 ---- *************** *** 226,230 **** static GaimPluginInfo info = { ! GAIM_PLUGIN_API_VERSION, /* api_version */ GAIM_PLUGIN_PROTOCOL, /* type */ NULL, /* ui_requirement */ --- 226,232 ---- static GaimPluginInfo info = { ! GAIM_PLUGIN_MAGIC, ! GAIM_MAJOR_VERSION, ! GAIM_MINOR_VERSION, GAIM_PLUGIN_PROTOCOL, /* type */ NULL, /* ui_requirement */ |
From: Don S. <ri...@us...> - 2004-09-10 18:08:25
|
Update of /cvsroot/gaim-bnet/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32524 Modified Files: docs.php footer.php header.php index.php style.css Log Message: New styles Index: footer.php =================================================================== RCS file: /cvsroot/gaim-bnet/htdocs/footer.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** footer.php 28 Jul 2004 13:33:23 -0000 1.2 --- footer.php 10 Sep 2004 18:07:57 -0000 1.3 *************** *** 6,10 **** <hr noshade size="1"> <a href="http://<?php echo $sfname ?>.sourceforge.net"><?php echo $name ?></a> is <a href="http://www.gnu.org/licenses/gpl.txt">GPL</a><br /> ! ©2004 Donald Seiler, <a href="mailto:do...@se...">do...@se...</a> </BODY> </HTML> --- 6,10 ---- <hr noshade size="1"> <a href="http://<?php echo $sfname ?>.sourceforge.net"><?php echo $name ?></a> is <a href="http://www.gnu.org/licenses/gpl.txt">GPL</a><br /> ! ©2003-2004 Don Seiler & Gary Kramlich </BODY> </HTML> Index: header.php =================================================================== RCS file: /cvsroot/gaim-bnet/htdocs/header.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** header.php 28 Jul 2004 13:24:58 -0000 1.1.1.1 --- header.php 10 Sep 2004 18:07:57 -0000 1.2 *************** *** 23,29 **** <a href="index.php#downloads">Downloads</a> | <a href="docs.php">Documentation</a> - <!-- | <a href="http://sourceforge.net/donate/index.php?group_id=<?php echo $groupid ?>">Donate!</a> --> </td> <td align="right"> <A href="http://sourceforge.net/projects/<?php echo $sfname ?>/"> <IMG src="http://sourceforge.net/sflogo.php?group_id=<?php echo $groupid ?>&type=2" border="0" alt="SourceForge.net Logo"></A></td></tr> </table> --- 23,30 ---- <a href="index.php#downloads">Downloads</a> | <a href="docs.php">Documentation</a> </td> <td align="right"> + <a href="http://sourceforge.net/donate/index.php?group_id=<?php echo $groupid ?>"><img src="http://sourceforge.net/images/project-support.jpg" alt="Support this project" border="0"/></a> + <A href="http://sourceforge.net/projects/<?php echo $sfname ?>/"> <IMG src="http://sourceforge.net/sflogo.php?group_id=<?php echo $groupid ?>&type=2" border="0" alt="SourceForge.net Logo"></A></td></tr> </table> |
From: Don S. <ri...@us...> - 2004-09-02 19:16:00
|
Update of /cvsroot/gaim-bnet/gaim-bnet/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6740/src Modified Files: bnet.c Log Message: Passing boolean to serv_got_update() per datallah's suggestion Index: bnet.c =================================================================== RCS file: /cvsroot/gaim-bnet/gaim-bnet/src/bnet.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bnet.c 23 Aug 2004 17:04:04 -0000 1.4 --- bnet.c 2 Sep 2004 19:15:52 -0000 1.5 *************** *** 153,157 **** { gaim_debug_info("bnet", "bnet_add_buddy\n"); ! serv_got_update(gc, b->name, 1, 0, 0, 0, 0); }; --- 153,157 ---- { gaim_debug_info("bnet", "bnet_add_buddy\n"); ! serv_got_update(gc, b->name, TRUE, 0, 0, 0, 0); }; |