aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-15 13:24:25 +0100
committerJelmer Vernooij <jelmer@samba.org>2005-12-15 13:24:25 +0100
commitbd69a219c0a618354fd80a98dd0d9a04fee755e0 (patch)
treeb4477537e48c6d7b2e5a261aa860a0688d69fb66 /protocols
parent2983f5e8c2d3046bf01337e5caefa3af55ba6bff (diff)
parentbf02a679c61b0f030ee8f2f01698699a7775f7d5 (diff)
Merge Wilmer
Diffstat (limited to 'protocols')
-rw-r--r--protocols/jabber/jabber.c21
-rw-r--r--protocols/msn/sb.c2
-rw-r--r--protocols/nogaim.c89
-rw-r--r--protocols/nogaim.h8
-rw-r--r--protocols/oscar/aim.h6
-rw-r--r--protocols/oscar/chat.c25
-rw-r--r--protocols/oscar/im.c26
-rw-r--r--protocols/oscar/oscar.c185
-rw-r--r--protocols/oscar/tlv.c25
-rw-r--r--protocols/proxy.c16
-rw-r--r--protocols/proxy.h2
-rw-r--r--protocols/yahoo/crypt.c4
-rw-r--r--protocols/yahoo/libyahoo2.c4
-rw-r--r--protocols/yahoo/yahoo.c10
-rw-r--r--protocols/yahoo/yahoo_httplib.c4
-rw-r--r--protocols/yahoo/yahoo_util.c4
16 files changed, 315 insertions, 116 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c
index 413f77ef..fc419124 100644
--- a/protocols/jabber/jabber.c
+++ b/protocols/jabber/jabber.c
@@ -21,10 +21,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#ifndef _WIN32
#include <sys/utsname.h>
#endif
@@ -58,6 +54,8 @@
#define DEFAULT_GROUPCHAT "conference.jabber.org"
#define DEFAULT_PORT 5222
#define DEFAULT_PORT_SSL 5223
+#define JABBER_PORT_MIN 5220
+#define JABBER_PORT_MAX 5229
#define JABBER_GROUP "Friends"
@@ -540,11 +538,6 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c
struct jabber_data *jd;
gjconn gjc;
- if (!g_slist_find(get_connections(), gc)) {
- ssl_disconnect(source);
- return;
- }
-
jd = gc->proto_data;
gjc = jd->gjc;
@@ -553,6 +546,11 @@ static void gjab_connected_ssl(gpointer data, void *source, GaimInputCondition c
return;
}
+ if (!g_slist_find(get_connections(), gc)) {
+ ssl_disconnect(source);
+ return;
+ }
+
gjab_connected(data, gjc->fd, cond);
}
@@ -588,6 +586,11 @@ static void gjab_start(gjconn gjc)
port = DEFAULT_PORT;
else if (port == -1 && ssl)
port = DEFAULT_PORT_SSL;
+ else if (port < JABBER_PORT_MIN || port > JABBER_PORT_MAX) {
+ serv_got_crap(GJ_GC(gjc), "For security reasons, the Jabber port number must be in the %d-%d range.", JABBER_PORT_MIN, JABBER_PORT_MAX);
+ STATE_EVT(JCONN_STATE_OFF)
+ return;
+ }
if (server == NULL)
server = g_strdup(gjc->user->server);
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index 793a881e..2f4d05d5 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -643,7 +643,7 @@ static int msn_sb_message( gpointer data, char *msg, int msglen, char **cmd, int
if( who )
{
- serv_got_typing( gc, who, 5 );
+ serv_got_typing( gc, who, 5, 1 );
g_free( who );
}
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 474b91b2..4966a76f 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -54,6 +54,7 @@ static int remove_chat_buddy_silent( struct conversation *b, char *handle );
GSList *connections;
+#ifdef WITH_PLUGINS
gboolean load_plugin(char *path)
{
void (*init_function) (void);
@@ -75,6 +76,34 @@ gboolean load_plugin(char *path)
return TRUE;
}
+void load_plugins(void)
+{
+ GDir *dir;
+ GError *error = NULL;
+
+ dir = g_dir_open(PLUGINDIR, 0, &error);
+
+ if (dir) {
+ const gchar *entry;
+ char *path;
+
+ while ((entry = g_dir_read_name(dir))) {
+ path = g_build_filename(PLUGINDIR, entry, NULL);
+ if(!path) {
+ log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);
+ continue;
+ }
+
+ load_plugin(path);
+
+ g_free(path);
+ }
+
+ g_dir_close(dir);
+ }
+}
+#endif
+
/* nogaim.c */
GList *protocols = NULL;
@@ -100,49 +129,30 @@ struct prpl *find_protocol(const char *name)
/* nogaim.c */
void nogaim_init()
{
- GDir *dir;
- GError *error = NULL;
+ extern void msn_init();
+ extern void oscar_init();
+ extern void byahoo_init();
+ extern void jabber_init();
#ifdef WITH_MSN
- extern void msn_init();
msn_init();
#endif
#ifdef WITH_OSCAR
- extern void oscar_init();
oscar_init();
#endif
#ifdef WITH_YAHOO
- extern void byahoo_init();
byahoo_init();
#endif
#ifdef WITH_JABBER
- extern void jabber_init();
jabber_init();
#endif
- dir = g_dir_open(PLUGINDIR, 0, &error);
-
- if (dir) {
- const gchar *entry;
- char *path;
-
- while ((entry = g_dir_read_name(dir))) {
- path = g_build_filename(PLUGINDIR, entry, NULL);
- if(!path) {
- log_message(LOGLVL_WARNING, "Can't build path for %s\n", entry);
- continue;
- }
-
- load_plugin(path);
-
- g_free(path);
- }
-
- g_dir_close(dir);
- }
+#ifdef WITH_PLUGINS
+ load_plugins();
+#endif
}
GSList *get_connections() { return connections; }
@@ -441,7 +451,14 @@ void signoff( struct gaim_connection *gc )
void do_error_dialog( struct gaim_connection *gc, char *msg, char *title )
{
- serv_got_crap( gc, "Error: %s", msg );
+ if( msg && title )
+ serv_got_crap( gc, "Error: %s: %s", title, msg );
+ else if( msg )
+ serv_got_crap( gc, "Error: %s", msg );
+ else if( title )
+ serv_got_crap( gc, "Error: %s", title );
+ else
+ serv_got_crap( gc, "Error" );
}
void do_ask_dialog( struct gaim_connection *gc, char *msg, void *data, void *doit, void *dont )
@@ -726,7 +743,7 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
/* If there's a newline/space in this string, split up there,
looks a bit prettier. */
- if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strchr( msg, ' ' ) ) )
+ if( ( nl = strrchr( msg, '\n' ) ) || ( nl = strrchr( msg, ' ' ) ) )
{
msg[425] = tmp;
tmp = *nl;
@@ -750,15 +767,25 @@ void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 f
irc_msgfrom( irc, u->nick, msg );
}
-void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout )
+void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type )
{
user_t *u;
if( !set_getint( gc->irc, "typing_notice" ) )
return;
- if( ( u = user_findhandle( gc, handle ) ) )
- irc_msgfrom( gc->irc, u->nick, "\1TYPING 1\1" );
+ if( ( u = user_findhandle( gc, handle ) ) ) {
+ /* If type is:
+ * 0: user has stopped typing
+ * 1: user is actively typing
+ * 2: user has entered text, but is not actively typing
+ */
+ if (type == 0 || type == 1 || type == 2) {
+ char buf[256];
+ g_snprintf(buf, 256, "\1TYPING %d\1", type);
+ irc_privmsg( gc->irc, u, "PRIVMSG", gc->irc->nick, NULL, buf );
+ }
+ }
}
void serv_got_chat_left( struct gaim_connection *gc, int id )
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index 3d5006d9..8ec65347 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -306,7 +306,7 @@ G_MODULE_EXPORT void show_got_added( struct gaim_connection *gc, char *id, char
/* server.c */
G_MODULE_EXPORT void serv_got_update( struct gaim_connection *gc, char *handle, int loggedin, int evil, time_t signon, time_t idle, int type, guint caps );
G_MODULE_EXPORT void serv_got_im( struct gaim_connection *gc, char *handle, char *msg, guint32 flags, time_t mtime, gint len );
-G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout );
+G_MODULE_EXPORT void serv_got_typing( struct gaim_connection *gc, char *handle, int timeout, int type );
G_MODULE_EXPORT void serv_got_chat_invite( struct gaim_connection *gc, char *handle, char *who, char *msg, GList *data );
G_MODULE_EXPORT struct conversation *serv_got_joined_chat( struct gaim_connection *gc, int id, char *handle );
G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
@@ -325,12 +325,6 @@ G_MODULE_EXPORT void strip_html( char *msg );
G_MODULE_EXPORT char * escape_html(const char *html);
G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);
-/* file transfers */
-G_MODULE_EXPORT void ft_progress( struct ft *, int);
-G_MODULE_EXPORT void ft_incoming( struct ft_request * );
-G_MODULE_EXPORT void ft_accepted( struct ft_request *, struct ft *);
-G_MODULE_EXPORT void ft_denied( struct ft_request *, const char *reason);
-
/* prefs.c */
G_MODULE_EXPORT void build_block_list();
G_MODULE_EXPORT void build_allow_list();
diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h
index f7bf1a8e..24cd7730 100644
--- a/protocols/oscar/aim.h
+++ b/protocols/oscar/aim.h
@@ -465,6 +465,7 @@ int aim_addtlvtochain_availmsg(aim_tlvlist_t **list, const guint16 type, const c
int aim_addtlvtochain_raw(aim_tlvlist_t **list, const guint16 t, const guint16 l, const guint8 *v);
int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps);
int aim_addtlvtochain_noval(aim_tlvlist_t **list, const guint16 type);
+int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui);
int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl);
int aim_counttlvchain(aim_tlvlist_t **list);
@@ -571,6 +572,11 @@ struct aim_chat_roominfo {
unsigned short instance;
};
+struct aim_chat_invitation {
+ struct gaim_connection * gc;
+ char * name;
+ guint8 exchange;
+};
#define AIM_VISIBILITYCHANGE_PERMITADD 0x05
#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06
diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c
index 60aabc79..033c2577 100644
--- a/protocols/oscar/chat.c
+++ b/protocols/oscar/chat.c
@@ -183,31 +183,6 @@ int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const
return 0;
}
-static int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance)
-{
- guint8 *buf;
- int buflen;
- aim_bstream_t bs;
-
- buflen = 2 + 1 + strlen(roomname) + 2;
-
- if (!(buf = g_malloc(buflen)))
- return 0;
-
- aim_bstream_init(&bs, buf, buflen);
-
- aimbs_put16(&bs, exchange);
- aimbs_put8(&bs, strlen(roomname));
- aimbs_putraw(&bs, (guint8 *)roomname, strlen(roomname));
- aimbs_put16(&bs, instance);
-
- aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf);
-
- g_free(buf);
-
- return 0;
-}
-
/*
* Join a room of name roomname. This is the first step to joining an
* already created room. It's basically a Service Request for
diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c
index 085687e0..c829d409 100644
--- a/protocols/oscar/im.c
+++ b/protocols/oscar/im.c
@@ -1368,6 +1368,30 @@ static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r
return ret;
}
+
+static void incomingim_ch2_chat_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args)
+{
+
+ /* XXX aim_chat_roominfo_free() */
+ g_free(args->info.chat.roominfo.name);
+
+ return;
+}
+
+static void incomingim_ch2_chat(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata)
+{
+
+ /*
+ * Chat room info.
+ */
+ if (servdata)
+ aim_chat_readroominfo(servdata, &args->info.chat.roominfo);
+
+ args->destructor = (void *)incomingim_ch2_chat_free;
+
+ return;
+}
+
static void incomingim_ch2_icqserverrelay_free(aim_session_t *sess, struct aim_incomingim_ch2_args *args)
{
@@ -1616,6 +1640,8 @@ static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *r
if (args.reqclass & AIM_CAPS_ICQSERVERRELAY)
incomingim_ch2_icqserverrelay(sess, mod, rx, snac, userinfo, &args, sdbsptr);
+ else if (args.reqclass & AIM_CAPS_CHAT)
+ incomingim_ch2_chat(sess, mod, rx, snac, userinfo, &args, sdbsptr);
if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 538f47ae..5f19f12b 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -61,7 +61,7 @@
/* Don't know if support for UTF8 is really working. For now it's UTF16 here.
static int gaim_caps = AIM_CAPS_UTF8; */
-static int gaim_caps = AIM_CAPS_INTEROP | AIM_CAPS_ICHAT | AIM_CAPS_ICQSERVERRELAY;
+static int gaim_caps = AIM_CAPS_INTEROP | AIM_CAPS_ICHAT | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_CHAT;
static guint8 gaim_features[] = {0x01, 0x01, 0x01, 0x02};
struct oscar_data {
@@ -155,7 +155,6 @@ static char *extract_name(const char *name) {
return tmp;
}
-#if 0
static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) {
GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats;
struct chat_connection *c = NULL;
@@ -170,7 +169,7 @@ static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int i
return c;
}
-#endif
+
static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc,
aim_conn_t *conn) {
@@ -1073,30 +1072,38 @@ static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_
return 1;
}
+void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv);
+void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv);
+
static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
-#if 0
struct gaim_connection *gc = sess->aux_data;
-#endif
if (args->status != AIM_RENDEZVOUS_PROPOSE)
return 1;
-#if 0
+
if (args->reqclass & AIM_CAPS_CHAT) {
char *name = extract_name(args->info.chat.roominfo.name);
int *exch = g_new0(int, 1);
GList *m = NULL;
+ char txt[1024];
+ struct aim_chat_invitation * inv = g_new0(struct aim_chat_invitation, 1);
+
m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name));
*exch = args->info.chat.roominfo.exchange;
m = g_list_append(m, exch);
- serv_got_chat_invite(gc,
- name ? name : args->info.chat.roominfo.name,
- userinfo->sn,
- (char *)args->msg,
- m);
+
+ g_snprintf( txt, 1024, "Got an invitation to chatroom %s from %s: %s", name, userinfo->sn, args->msg );
+
+ inv->gc = gc;
+ inv->exchange = *exch;
+ inv->name = g_strdup(name);
+
+ do_ask_dialog( gc, txt, inv, oscar_accept_chat, oscar_reject_chat);
+
if (name)
g_free(name);
}
-#endif
+
return 1;
}
@@ -2440,10 +2447,20 @@ int gaim_parsemtn(aim_session_t *sess, aim_frame_t *fr, ...)
sn = va_arg(ap, char*);
type2 = va_arg(ap, int);
va_end(ap);
-
- if(type2 == 0x0001 || type2 == 0x0002)
- serv_got_typing(gc, sn, 0);
-
+
+ if(type2 == 0x0002) {
+ /* User is typing */
+ serv_got_typing(gc, sn, 0, 1);
+ }
+ else if (type2 == 0x0001) {
+ /* User has typed something, but is not actively typing (stale) */
+ serv_got_typing(gc, sn, 0, 2);
+ }
+ else {
+ /* User has stopped typing */
+ serv_got_typing(gc, sn, 0, 0);
+ }
+
return 1;
}
@@ -2481,6 +2498,138 @@ int oscar_send_typing(struct gaim_connection *gc, char * who, int typing)
return( aim_im_sendmtn(od->sess, 1, who, typing ? 0x0002 : 0x0000) );
}
+int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
+{
+ struct oscar_data * od = (struct oscar_data*)gc->proto_data;
+ struct chat_connection * ccon;
+ int ret;
+ guint8 len = strlen(message);
+ char *s;
+
+ if(!(ccon = find_oscar_chat(gc, id)))
+ return -1;
+
+ for (s = message; *s; s++)
+ if (*s & 128)
+ break;
+
+ /* Message contains high ASCII chars, time for some translation! */
+ if (*s) {
+ s = g_malloc(BUF_LONG);
+ /* Try if we can put it in an ISO8859-1 string first.
+ If we can't, fall back to UTF16. */
+ if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) {
+ len = ret;
+ } else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) {
+ len = ret;
+ } else {
+ /* OOF, translation failed... Oh well.. */
+ g_free( s );
+ s = message;
+ }
+ } else {
+ s = message;
+ }
+
+ ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len);
+
+ if (s != message) {
+ g_free(s);
+ }
+
+ return (ret >= 0);
+}
+
+void oscar_chat_invite(struct gaim_connection * gc, int id, char *message, char *who)
+{
+ struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+ struct chat_connection *ccon = find_oscar_chat(gc, id);
+
+ if (ccon == NULL)
+ return;
+
+ aim_chat_invite(od->sess, od->conn, who, message ? message : "",
+ ccon->exchange, ccon->name, 0x0);
+}
+
+void oscar_chat_kill(struct gaim_connection *gc, struct chat_connection *cc)
+{
+ struct oscar_data *od = (struct oscar_data *)gc->proto_data;
+
+ /* Notify the conversation window that we've left the chat */
+ serv_got_chat_left(gc, cc->id);
+
+ /* Destroy the chat_connection */
+ od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
+ if (cc->inpa > 0)
+ gaim_input_remove(cc->inpa);
+ aim_conn_kill(od->sess, &cc->conn);
+ g_free(cc->name);
+ g_free(cc->show);
+ g_free(cc);
+}
+
+void oscar_chat_leave(struct gaim_connection * gc, int id)
+{
+ struct chat_connection * ccon = find_oscar_chat(gc, id);
+
+ if(ccon == NULL)
+ return;
+
+ oscar_chat_kill(gc, ccon);
+}
+
+int oscar_chat_join(struct gaim_connection * gc, char * name)
+{
+ struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+
+ aim_conn_t * cur;
+
+ if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
+
+ return (aim_chatnav_createroom(od->sess, cur, name, 4) == 0);
+
+ } else {
+ struct create_room * cr = g_new0(struct create_room, 1);
+ cr->exchange = 4;
+ cr->name = g_strdup(name);
+ od->create_rooms = g_slist_append(od->create_rooms, cr);
+ aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
+ return 1;
+ }
+}
+
+int oscar_chat_open(struct gaim_connection * gc, char *who)
+{
+ struct oscar_data * od = (struct oscar_data *)gc->proto_data;
+ int ret;
+ static int chat_id = 0;
+ char * chatname = g_new0(char, strlen(gc->username)+4);
+
+ g_snprintf(chatname, strlen(gc->username) + 4, "%s%d", gc->username, chat_id++);
+
+ ret = oscar_chat_join(gc, chatname);
+
+ aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
+
+ g_free(chatname);
+
+ return ret;
+}
+
+void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv)
+{
+ oscar_chat_join(inv->gc, inv->name);
+ g_free(inv->name);
+ g_free(inv);
+}
+
+void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv)
+{
+ g_free(inv->name);
+ g_free(inv);
+}
+
void oscar_init()
{
struct prpl *ret = g_new0(struct prpl, 1);
@@ -2494,6 +2643,10 @@ void oscar_init()
ret->get_away = oscar_get_away;
ret->add_buddy = oscar_add_buddy;
ret->remove_buddy = oscar_remove_buddy;
+ ret->chat_send = oscar_chat_send;
+ ret->chat_invite = oscar_chat_invite;
+ ret->chat_leave = oscar_chat_leave;
+ ret->chat_open = oscar_chat_open;
ret->add_permit = oscar_add_permit;
ret->add_deny = oscar_add_deny;
ret->rem_permit = oscar_rem_permit;
diff --git a/protocols/oscar/tlv.c b/protocols/oscar/tlv.c
index 11b89758..9d827caf 100644
--- a/protocols/oscar/tlv.c
+++ b/protocols/oscar/tlv.c
@@ -339,6 +339,31 @@ int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvl
return buflen;
}
+int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance)
+{
+ guint8 *buf;
+ int buflen;
+ aim_bstream_t bs;
+
+ buflen = 2 + 1 + strlen(roomname) + 2;
+
+ if (!(buf = g_malloc(buflen)))
+ return 0;
+
+ aim_bstream_init(&bs, buf, buflen);
+
+ aimbs_put16(&bs, exchange);
+ aimbs_put8(&bs, strlen(roomname));
+ aimbs_putraw(&bs, (guint8 *)roomname, strlen(roomname));
+ aimbs_put16(&bs, instance);
+
+ aim_addtlvtochain_raw(list, type, aim_bstream_curpos(&bs), buf);
+
+ g_free(buf);
+
+ return 0;
+}
+
/**
* aim_writetlvchain - Write a TLV chain into a data buffer.
* @buf: Destination buffer
diff --git a/protocols/proxy.c b/protocols/proxy.c
index 6d450c92..0546f2d7 100644
--- a/protocols/proxy.c
+++ b/protocols/proxy.c
@@ -72,7 +72,7 @@ typedef struct _GaimIOClosure {
-static struct sockaddr_in *gaim_gethostbyname(char *host, int port)
+static struct sockaddr_in *gaim_gethostbyname(const char *host, int port)
{
static struct sockaddr_in sin;
@@ -113,7 +113,7 @@ static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpoin
return TRUE;
}
-static void no_one_calls(gpointer data, gint source, GaimInputCondition cond)
+static void gaim_io_connected(gpointer data, gint source, GaimInputCondition cond)
{
struct PHB *phb = data;
unsigned int len;
@@ -143,7 +143,7 @@ static void no_one_calls(gpointer data, gint source, GaimInputCondition cond)
}
}
-static int proxy_connect_none(char *host, unsigned short port, struct PHB *phb)
+static int proxy_connect_none(const char *host, unsigned short port, struct PHB *phb)
{
struct sockaddr_in *sin;
int fd = -1;
@@ -162,7 +162,7 @@ static int proxy_connect_none(char *host, unsigned short port, struct PHB *phb)
if (connect(fd, (struct sockaddr *)sin, sizeof(*sin)) < 0) {
if (sockerr_again()) {
- phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, no_one_calls, phb);
+ phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, gaim_io_connected, phb);
phb->fd = fd;
} else {
closesocket(fd);
@@ -270,7 +270,7 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond)
phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb);
}
-static int proxy_connect_http(char *host, unsigned short port, struct PHB *phb)
+static int proxy_connect_http(const char *host, unsigned short port, struct PHB *phb)
{
phb->host = g_strdup(host);
phb->port = port;
@@ -354,7 +354,7 @@ static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond)
phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb);
}
-static int proxy_connect_socks4(char *host, unsigned short port, struct PHB *phb)
+static int proxy_connect_socks4(const char *host, unsigned short port, struct PHB *phb)
{
phb->host = g_strdup(host);
phb->port = port;
@@ -536,7 +536,7 @@ static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond)
phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb);
}
-static int proxy_connect_socks5(char *host, unsigned short port, struct PHB *phb)
+static int proxy_connect_socks5(const char *host, unsigned short port, struct PHB *phb)
{
phb->host = g_strdup(host);
phb->port = port;
@@ -577,7 +577,7 @@ void gaim_input_remove(gint tag)
g_source_remove(tag);
}
-int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data)
+int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data)
{
struct PHB *phb;
diff --git a/protocols/proxy.h b/protocols/proxy.h
index 7c34fc40..47c966d2 100644
--- a/protocols/proxy.h
+++ b/protocols/proxy.h
@@ -55,6 +55,6 @@ typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition);
G_MODULE_EXPORT gint gaim_input_add(int, GaimInputCondition, GaimInputFunction, gpointer);
G_MODULE_EXPORT void gaim_input_remove(gint);
-G_MODULE_EXPORT int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data);
+G_MODULE_EXPORT int proxy_connect(const char *host, int port, GaimInputFunction func, gpointer data);
#endif /* _PROXY_H_ */
diff --git a/protocols/yahoo/crypt.c b/protocols/yahoo/crypt.c
index 00eed70b..5122e3af 100644
--- a/protocols/yahoo/crypt.c
+++ b/protocols/yahoo/crypt.c
@@ -22,10 +22,6 @@
* already had. isn't that lovely. people should just use linux or
* freebsd, crypt works properly on those systems. i hate solaris */
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#if HAVE_STRING_H
# include <string.h>
#elif HAVE_STRINGS_H
diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c
index 62ceb0af..c691f18b 100644
--- a/protocols/yahoo/libyahoo2.c
+++ b/protocols/yahoo/libyahoo2.c
@@ -43,10 +43,6 @@
*
*/
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#ifndef _WIN32
#include <unistd.h>
#endif
diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c
index e55b30af..832d1ab4 100644
--- a/protocols/yahoo/yahoo.c
+++ b/protocols/yahoo/yahoo.c
@@ -634,8 +634,14 @@ void ext_yahoo_got_file( int id, char *who, char *url, long expires, char *msg,
void ext_yahoo_typing_notify( int id, char *who, int stat )
{
struct gaim_connection *gc = byahoo_get_gc_by_id( id );
-
- serv_got_typing( gc, who, 1 );
+ if (stat == 1) {
+ /* User is typing */
+ serv_got_typing( gc, who, 1, 1 );
+ }
+ else {
+ /* User stopped typing */
+ serv_got_typing( gc, who, 1, 0 );
+ }
}
void ext_yahoo_system_message( int id, char *msg )
diff --git a/protocols/yahoo/yahoo_httplib.c b/protocols/yahoo/yahoo_httplib.c
index 41e31a23..dbbe2a84 100644
--- a/protocols/yahoo/yahoo_httplib.c
+++ b/protocols/yahoo/yahoo_httplib.c
@@ -19,10 +19,6 @@
*
*/
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
diff --git a/protocols/yahoo/yahoo_util.c b/protocols/yahoo/yahoo_util.c
index cb155e3c..3c99cf44 100644
--- a/protocols/yahoo/yahoo_util.c
+++ b/protocols/yahoo/yahoo_util.c
@@ -19,10 +19,6 @@
*
*/
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#if STDC_HEADERS
# include <string.h>
#else