aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/oscar
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/oscar')
-rw-r--r--protocols/oscar/aim.h7
-rw-r--r--protocols/oscar/chat.c16
-rw-r--r--protocols/oscar/im.c2
-rw-r--r--protocols/oscar/oscar.c21
4 files changed, 35 insertions, 11 deletions
diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h
index 24cd7730..93887103 100644
--- a/protocols/oscar/aim.h
+++ b/protocols/oscar/aim.h
@@ -727,8 +727,11 @@ struct aim_chat_exchangeinfo {
char *lang2;
};
-#define AIM_CHATFLAGS_NOREFLECT 0x0001
-#define AIM_CHATFLAGS_AWAY 0x0002
+#define AIM_CHATFLAGS_NOREFLECT 0x0001
+#define AIM_CHATFLAGS_AWAY 0x0002
+#define AIM_CHATFLAGS_UNICODE 0x0004
+#define AIM_CHATFLAGS_ISO_8859_1 0x0008
+
int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);
int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);
int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);
diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c
index 033c2577..df535c4f 100644
--- a/protocols/oscar/chat.c
+++ b/protocols/oscar/chat.c
@@ -158,7 +158,21 @@ int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const
*/
if (flags & AIM_CHATFLAGS_AWAY)
aim_addtlvtochain_noval(&otl, 0x0007);
-
+
+ /* [WvG] This wasn't there originally, but we really should send
+ the right charset flags, as we also do with normal
+ messages. Hope this will work. :-) */
+ /*
+ if (flags & AIM_CHATFLAGS_UNICODE)
+ aimbs_put16(&fr->data, 0x0002);
+ else if (flags & AIM_CHATFLAGS_ISO_8859_1)
+ aimbs_put16(&fr->data, 0x0003);
+ else
+ aimbs_put16(&fr->data, 0x0000);
+
+ aimbs_put16(&fr->data, 0x0000);
+ */
+
/*
* SubTLV: Type 1: Message
*/
diff --git a/protocols/oscar/im.c b/protocols/oscar/im.c
index c829d409..7cccabc7 100644
--- a/protocols/oscar/im.c
+++ b/protocols/oscar/im.c
@@ -1468,7 +1468,7 @@ static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod
case AIM_MTYPE_AUTOFFC:
case 0x9c: /* ICQ 5 seems to send this */
aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
- gc->away, sess->aim_icq_state, dc);
+ gc->away ? gc->away : "", sess->aim_icq_state, dc);
break;
}
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index ca3210ef..7c76533a 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -1,6 +1,8 @@
/*
* gaim
*
+ * Some code copyright (C) 2002-2006, Jelmer Vernooij <jelmer@samba.org>
+ * and the BitlBee team.
* Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
* libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
*
@@ -135,9 +137,9 @@ static char *extract_name(const char *name) {
char *tmp;
int i, j;
char *x = strchr(name, '-');
- if (!x) return NULL;
+ if (!x) return g_strdup(name);
x = strchr(++x, '-');
- if (!x) return NULL;
+ if (!x) return g_strdup(name);
tmp = g_strdup(++x);
for (i = 0, j = 0; x[i]; i++) {
@@ -389,7 +391,7 @@ static void oscar_login(struct aim_user *user) {
if (g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.icq.com") != 0 &&
g_strcasecmp(user->proto_opt[USEROPT_AUTH], "login.oscar.aol.com") != 0) {
- serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.");
+ serv_got_crap(gc, "Warning: Unknown OSCAR server: `%s'. Please review your configuration if the connection fails.",user->proto_opt[USEROPT_AUTH]);
}
g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username);
@@ -2516,6 +2518,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
struct chat_connection * ccon;
int ret;
guint8 len = strlen(message);
+ guint16 flags;
char *s;
if(!(ccon = find_oscar_chat(gc, id)))
@@ -2524,15 +2527,19 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
for (s = message; *s; s++)
if (*s & 128)
break;
-
+
+ flags = AIM_CHATFLAGS_NOREFLECT;
+
/* 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) {
+ flags |= AIM_CHATFLAGS_ISO_8859_1;
len = ret;
} else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) {
+ flags |= AIM_CHATFLAGS_UNICODE;
len = ret;
} else {
/* OOF, translation failed... Oh well.. */
@@ -2543,7 +2550,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)
s = message;
}
- ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len);
+ ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len);
if (s != message) {
g_free(s);
@@ -2616,9 +2623,9 @@ 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);
+ char * chatname;
- g_snprintf(chatname, strlen(gc->username) + 4, "%s%d", gc->username, chat_id++);
+ chatname = g_strdup_printf("%s%d", gc->username, chat_id++);
ret = oscar_chat_join(gc, chatname);