Mercurial > pidgin.yaz
changeset 6059:d8cd876e613e
[gaim-migrate @ 6509]
I made a lot of server.c functions use const chat * instead of const *
Made the alias entry have focus in the alias buddy dialog.
Fixed a typo thanks to J. Silvestri
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 08 Jul 2003 03:36:41 +0000 |
parents | d5f4ae4f9a02 |
children | 6b4a12cd4caf |
files | src/blist.h src/dialogs.c src/protocols/gg/gg.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/aim.h src/protocols/oscar/im.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/trepia/trepia.c src/protocols/yahoo/yahoo.c src/protocols/zephyr/zephyr.c src/prpl.h src/server.c src/server.h |
diffstat | 17 files changed, 157 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blist.h Tue Jul 08 02:33:17 2003 +0000 +++ b/src/blist.h Tue Jul 08 03:36:41 2003 +0000 @@ -265,7 +265,7 @@ void gaim_blist_alias_buddy(struct buddy *buddy, const char *alias); /** - * Sets the server-sent aliase of a buddy in the buddy list. + * Sets the server-sent alias of a buddy in the buddy list. * * @param buddy The buddy whose alias will be changed. * @param alias The buddy's "official" alias.
--- a/src/dialogs.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/dialogs.c Tue Jul 08 03:36:41 2003 +0000 @@ -3791,7 +3791,7 @@ gtk_widget_show_all(alias_dialog); if (info) - gtk_widget_grab_focus(info->name_entry); + gtk_widget_grab_focus(info->alias_entry); }
--- a/src/protocols/gg/gg.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/gg/gg.c Tue Jul 08 03:36:41 2003 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 6360 2003-06-18 06:01:15Z chipx86 $ + * $Id: gg.c 6509 2003-07-08 03:36:41Z thekingant $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -163,7 +163,7 @@ return msg; } -static void agg_set_away(GaimConnection *gc, char *state, char *msg) +static void agg_set_away(GaimConnection *gc, const char *state, const char *msg) { struct agg_data *gd = (struct agg_data *)gc->proto_data; int status = gd->own_status; @@ -591,7 +591,7 @@ gg_add_notify(gd->sess, strtol(who, (char **)NULL, 10)); } -static void agg_rem_buddy(GaimConnection *gc, char *who, char *group) +static void agg_rem_buddy(GaimConnection *gc, const char *who, const char *group) { struct agg_data *gd = (struct agg_data *)gc->proto_data; if (invalid_uin(who))
--- a/src/protocols/irc/irc.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/irc/irc.c Tue Jul 08 03:36:41 2003 +0000 @@ -1249,7 +1249,7 @@ } static void -irc_convo_closed(GaimConnection *gc, char *who) +irc_convo_closed(GaimConnection *gc, const char *who) { struct dcc_chat *dchat = find_dcc_chat(gc, who); if (!dchat) @@ -2460,7 +2460,7 @@ static void irc_add_buddy(GaimConnection *gc, const char *who) {} static void -irc_remove_buddy(GaimConnection *gc, char *who, char *group) {} +irc_remove_buddy(GaimConnection *gc, const char *who, const char *group) {} static GList * irc_chat_info(GaimConnection *gc) @@ -2515,14 +2515,14 @@ } static int -irc_chat_send(GaimConnection *gc, int id, char *what) +irc_chat_send(GaimConnection *gc, int id, const char *what) { GaimConversation *c = gaim_find_chat(gc, id); if (!c) return -EINVAL; if (send_msg(gc, c->name, what) > 0) serv_got_chat_in(gc, gaim_chat_get_id(GAIM_CHAT(c)), - (char *)gaim_connection_get_display_name(gc), 0, what, time(NULL)); + gaim_connection_get_display_name(gc), 0, what, time(NULL)); return 0; } @@ -2533,7 +2533,7 @@ } static void -irc_set_away(GaimConnection *gc, char *state, char *msg) +irc_set_away(GaimConnection *gc, const char *state, const char *msg) { struct irc_data *idata = gc->proto_data; char buf[IRC_BUF_LEN];
--- a/src/protocols/jabber/jabber.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/jabber/jabber.c Tue Jul 08 03:36:41 2003 +0000 @@ -1199,7 +1199,7 @@ jri->away_msg = g_strdup(xmlnode_get_tag_data(p->x, "status")); } -static void jabber_convo_closed(GaimConnection *gc, char *name) +static void jabber_convo_closed(GaimConnection *gc, const char *name) { jab_res_info jri = jabber_find_resource(gc, name); @@ -2452,7 +2452,7 @@ gc->proto_data = NULL; } -static int jabber_send_typing(GaimConnection *gc, char *who, int typing) +static int jabber_send_typing(GaimConnection *gc, const char *who, int typing) { xmlnode x, y; char *realwho; @@ -2710,7 +2710,7 @@ g_free(realwho); } -static void jabber_remove_buddy(GaimConnection *gc, char *name, char *group) +static void jabber_remove_buddy(GaimConnection *gc, const char *name, const char *group) { xmlnode x; char *realwho; @@ -3089,7 +3089,7 @@ jc->b = NULL; } -static int jabber_chat_send(GaimConnection *gc, int id, char *message) +static int jabber_chat_send(GaimConnection *gc, int id, const char *message) { xmlnode x, y; struct jabber_chat *jc = NULL; @@ -3124,7 +3124,7 @@ return 0; } -static void jabber_chat_whisper(GaimConnection *gc, int id, char *who, char *message) +static void jabber_chat_whisper(GaimConnection *gc, int id, const char *who, const char *message) { xmlnode x; struct jabber_chat *jc = NULL; @@ -3291,7 +3291,7 @@ } -static void jabber_get_cb_info(GaimConnection *gc, int cid, char *who) { +static void jabber_get_cb_info(GaimConnection *gc, int cid, const char *who) { struct jabber_chat *jc = NULL; char *realwho; @@ -3305,7 +3305,7 @@ g_free(realwho); } -static void jabber_get_cb_away_msg(GaimConnection *gc, int cid, char *who) { +static void jabber_get_cb_away_msg(GaimConnection *gc, int cid, const char *who) { struct jabber_chat *jc = NULL; char *realwho; @@ -3439,7 +3439,7 @@ return m; } -static void jabber_set_away(GaimConnection *gc, char *state, char *message) +static void jabber_set_away(GaimConnection *gc, const char *state, const char *message) { xmlnode x, y; struct jabber_data *jd = gc->proto_data;
--- a/src/protocols/msn/msn.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/msn/msn.c Tue Jul 08 03:36:41 2003 +0000 @@ -494,7 +494,7 @@ } static int -msn_send_typing(GaimConnection *gc, char *who, int typing) +msn_send_typing(GaimConnection *gc, const char *who, int typing) { GaimAccount *account = gaim_connection_get_account(gc); MsnSession *session = gc->proto_data; @@ -538,7 +538,7 @@ } static void -msn_set_away(GaimConnection *gc, char *state, char *msg) +msn_set_away(GaimConnection *gc, const char *state, const char *msg) { MsnSession *session = gc->proto_data; const char *away; @@ -636,7 +636,7 @@ } static void -msn_rem_buddy(GaimConnection *gc, char *who, char *group) +msn_rem_buddy(GaimConnection *gc, const char *who, const char *group) { MsnSession *session = gc->proto_data; char outparams[MSN_BUF_LEN]; @@ -932,7 +932,7 @@ } static int -msn_chat_send(GaimConnection *gc, int id, char *message) +msn_chat_send(GaimConnection *gc, int id, const char *message) { GaimAccount *account = gaim_connection_get_account(gc); MsnSession *session = gc->proto_data; @@ -961,7 +961,7 @@ msn_message_destroy(msg); - serv_got_chat_in(gc, id, (char *)gaim_account_get_username(account), + serv_got_chat_in(gc, id, gaim_account_get_username(account), 0, message, time(NULL)); return 0; @@ -1096,7 +1096,7 @@ } static void -msn_convo_closed(GaimConnection *gc, char *who) +msn_convo_closed(GaimConnection *gc, const char *who) { GaimAccount *account = gaim_connection_get_account(gc); MsnSession *session = gc->proto_data;
--- a/src/protocols/napster/napster.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/napster/napster.c Tue Jul 08 03:36:41 2003 +0000 @@ -159,7 +159,7 @@ } /* 303 - MSG_CLIENT_REMOVE_HOTLIST */ -static void nap_remove_buddy(GaimConnection *gc, char *name, char *group) +static void nap_remove_buddy(GaimConnection *gc, const char *name, const char *group) { nap_write_packet(gc, 303, "%s", name); } @@ -193,7 +193,7 @@ } /* 402 - MSG_CLIENT_PUBLIC */ -static int nap_chat_send(GaimConnection *gc, int id, char *message) +static int nap_chat_send(GaimConnection *gc, int id, const char *message) { GaimConversation *c = gaim_find_chat(gc, id);
--- a/src/protocols/oscar/aim.h Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/oscar/aim.h Tue Jul 08 03:36:41 2003 +0000 @@ -859,7 +859,7 @@ /* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); /* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags); /* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code); -/* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2); +/* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2);
--- a/src/protocols/oscar/im.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/oscar/im.c Tue Jul 08 03:36:41 2003 +0000 @@ -2186,7 +2186,7 @@ * and Gaim 0.60 and newer. * */ -faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2) +faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2) { aim_conn_t *conn; aim_frame_t *fr;
--- a/src/protocols/oscar/oscar.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Jul 08 03:36:41 2003 +0000 @@ -2282,7 +2282,7 @@ serv_got_chat_invite(gc, name ? name : args->info.chat.roominfo.name, userinfo->sn, - (char *)args->msg, + args->msg, components); if (name) g_free(name); @@ -4208,7 +4208,7 @@ aim_flap_nop(od->sess, od->conn); } -static int oscar_send_typing(GaimConnection *gc, char *name, int typing) { +static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; struct direct_im *dim = find_direct_im(od, name); if (dim) @@ -4572,7 +4572,7 @@ return; } -static void oscar_set_away(GaimConnection *gc, char *state, char *message) +static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; @@ -4584,7 +4584,7 @@ return; } -static void oscar_warn(GaimConnection *gc, char *name, int anon) { +static void oscar_warn(GaimConnection *gc, const char *name, int anon) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); } @@ -4645,7 +4645,7 @@ #endif } -static void oscar_remove_buddy(GaimConnection *gc, char *name, char *group) { +static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { struct oscar_data *od = (struct oscar_data *)gc->proto_data; #ifdef NOSSI aim_remove_buddy(od->sess, od->conn, name); @@ -5252,7 +5252,7 @@ serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); } -static int oscar_chat_send(GaimConnection *g, int id, char *message) { +static int oscar_chat_send(GaimConnection *g, int id, const char *message) { struct oscar_data *od = (struct oscar_data *)g->proto_data; GSList *bcs = g->buddy_chats; GaimConversation *b = NULL; @@ -6190,7 +6190,7 @@ } } -static void oscar_convo_closed(GaimConnection *gc, char *who) +static void oscar_convo_closed(GaimConnection *gc, const char *who) { struct oscar_data *od = gc->proto_data; struct direct_im *dim = find_direct_im(od, who);
--- a/src/protocols/toc/toc.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/toc/toc.c Tue Jul 08 03:36:41 2003 +0000 @@ -318,40 +318,61 @@ return cnt; } -static int escape_text(char *msg) +/* + * Duplicates the input string, replacing each \n with a <BR>, and + * escaping a few other characters. + */ +char *escape_text(const char *msg) { - char *c, *cpy; - int cnt = 0; - /* Assumes you have a buffer able to cary at least BUF_LEN * 4 bytes */ - if (strlen(msg) > BUF_LEN) { - fprintf(stderr, "Warning: truncating message to 2048 bytes\n"); - msg[2047] = '\0'; - } + char *ret; + int i, j; - cpy = g_strdup(msg); - c = cpy; - while (*c) { - switch (*c) { + if (!msg) + return NULL; + + /* Calculate the length after escaping */ + i = 0; + j = 0; + while (msg[i++]) + switch (msg[i]) { case '\n': - msg[cnt++] = '<'; - msg[cnt++] = 'B'; - msg[cnt++] = 'R'; - msg[cnt++] = '>'; + j += 4; break; case '{': case '}': case '\\': case '"': - msg[cnt++] = '\\'; - /* Fall through */ + j += 1; default: - msg[cnt++] = *c; + j += 1; } - c++; + + /* Allocate a string */ + ret = (char *)malloc((j+1) * sizeof(char)); + + /* Copy the string */ + i = 0; + j = 0; + while (msg[i++]) { + switch (msg[i]) { + case '\n': + ret[j++] = '<'; + ret[j++] = 'B'; + ret[j++] = 'R'; + ret[j++] = '>'; + break; + case '{': + case '}': + case '\\': + case '"': + ret[j++] = '\\'; + default: + ret[j++] = msg[i]; + } } - msg[cnt] = '\0'; - g_free(cpy); - return cnt; + ret[j] = '\0'; + + return ret; } static int sflap_send(GaimConnection *gc, char *buf, int olen, int type) @@ -1005,10 +1026,9 @@ static int toc_send_im(GaimConnection *gc, const char *name, const char *message, int len, int flags) { char buf[BUF_LEN * 2]; - char *tmp = g_malloc(strlen(message) * 4 + 1); /* 4 because \n gets replaced with <BR> */ + char *tmp; - strcpy(tmp, message); - escape_text(tmp); + tmp = escape_text(message); if (strlen(tmp) + 52 > MSG_LEN) { g_free(tmp); return -E2BIG; @@ -1047,11 +1067,12 @@ static void toc_set_dir(GaimConnection *g, const char *first, const char *middle, const char *last, const char *maiden, const char *city, const char *state, const char *country, int web) { - char buf2[BUF_LEN * 4], buf[BUF_LEN]; + char *buf3, buf2[BUF_LEN * 4], buf[BUF_LEN]; g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, (web == 1) ? "Y" : ""); - escape_text(buf2); - g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); + buf3 = escape_text(buf2); + g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf3); + g_free(buf3); sflap_send(g, buf, -1, TYPE_DATA); } @@ -1066,7 +1087,7 @@ sflap_send(g, buf, -1, TYPE_DATA); } -static void toc_set_away(GaimConnection *g, char *state, char *message) +static void toc_set_away(GaimConnection *g, const char *state, const char *message) { char buf[BUF_LEN * 2]; if (g->away) { @@ -1074,10 +1095,9 @@ g->away = NULL; } if (message) { - char *tmp = g_malloc(strlen(message) * 4 + 1); - strcpy(tmp, message); - g->away = g_strdup (message); - escape_text(tmp); + char *tmp; + g->away = g_strdup(message); + tmp = escape_text(message); g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", tmp); g_free(tmp); } else @@ -1087,10 +1107,10 @@ static void toc_set_info(GaimConnection *g, const char *info) { - char buf[BUF_LEN * 2], buf2[BUF_LEN * 2]; - g_snprintf(buf2, sizeof buf2, "%s", info); - escape_text(buf2); + char buf[BUF_LEN * 2], *buf2; + buf2 = escape_text(info); g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", buf2); + g_free(buf2); sflap_send(g, buf, -1, TYPE_DATA); } @@ -1126,7 +1146,7 @@ sflap_send(g, buf, -1, TYPE_DATA); } -static void toc_remove_buddy(GaimConnection *g, char *name, char *group) +static void toc_remove_buddy(GaimConnection *g, const char *name, const char *group) { char buf[BUF_LEN * 2]; g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); @@ -1159,7 +1179,7 @@ sflap_send(g, buf, -1, TYPE_DATA); } -static void toc_warn(GaimConnection *g, char *name, int anon) +static void toc_warn(GaimConnection *g, const char *name, int anon) { char send[BUF_LEN * 2]; g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); @@ -1241,22 +1261,28 @@ } } -static void toc_chat_whisper(GaimConnection *g, int id, char *who, char *message) +static void toc_chat_whisper(GaimConnection *g, int id, const char *who, const char *message) { - char buf2[BUF_LEN * 2]; - escape_text(message); - g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, normalize(who), message); + char *buf1, *buf2; + buf1 = escape_text(message); + buf2 = g_strdup_printf("toc_chat_whisper %d %s \"%s\"", id, normalize(who), buf1); + g_free(buf1); sflap_send(g, buf2, -1, TYPE_DATA); + g_free(buf2); } -static int toc_chat_send(GaimConnection *g, int id, char *message) +static int toc_chat_send(GaimConnection *g, int id, const char *message) { - char buf[BUF_LEN * 2]; - escape_text(message); - if (strlen(message) > 2000) + char *buf1, *buf2; + buf1 = escape_text(message); + if (strlen(buf1) > 2000) { + g_free(buf1); return -E2BIG; - g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"", id, message); - sflap_send(g, buf, -1, TYPE_DATA); + } + buf2 = g_strdup_printf("toc_chat_send %d \"%s\"", id, buf1); + g_free(buf1); + sflap_send(g, buf2, -1, TYPE_DATA); + g_free(buf2); return 0; }
--- a/src/protocols/trepia/trepia.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/trepia/trepia.c Tue Jul 08 03:36:41 2003 +0000 @@ -1219,7 +1219,7 @@ } static void -trepia_rem_buddy(GaimConnection *gc, char *who, char *group) +trepia_rem_buddy(GaimConnection *gc, const char *who, const char *group) { }
--- a/src/protocols/yahoo/yahoo.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Tue Jul 08 03:36:41 2003 +0000 @@ -1214,7 +1214,7 @@ return 1; } -int yahoo_send_typing(GaimConnection *gc, char *who, int typ) +int yahoo_send_typing(GaimConnection *gc, const char *who, int typ) { struct yahoo_data *yd = gc->proto_data; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); @@ -1232,7 +1232,7 @@ return 0; } -static void yahoo_set_away(GaimConnection *gc, char *state, char *msg) +static void yahoo_set_away(GaimConnection *gc, const char *state, const char *msg) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; struct yahoo_packet *pkt; @@ -1376,7 +1376,7 @@ yahoo_packet_free(pkt); } -static void yahoo_remove_buddy(GaimConnection *gc, char *who, char *group) +static void yahoo_remove_buddy(GaimConnection *gc, const char *who, const char *group) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
--- a/src/protocols/zephyr/zephyr.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Jul 08 03:36:41 2003 +0000 @@ -741,9 +741,9 @@ } static void zephyr_add_buddy(GaimConnection *gc, const char *buddy) { } -static void zephyr_remove_buddy(GaimConnection *gc, char *buddy, char *group) { } +static void zephyr_remove_buddy(GaimConnection *gc, const char *buddy, const char *group) { } -static int zephyr_chat_send(GaimConnection *gc, int id, char *im) +static int zephyr_chat_send(GaimConnection *gc, int id, const char *im) { ZNotice_t notice; zephyr_triple *zt; @@ -853,7 +853,7 @@ return m; } -static void zephyr_set_away(GaimConnection *gc, char *state, char *msg) +static void zephyr_set_away(GaimConnection *gc, const char *state, const char *msg) { if (gc->away) { g_free(gc->away);
--- a/src/prpl.h Tue Jul 08 02:33:17 2003 +0000 +++ b/src/prpl.h Tue Jul 08 03:36:41 2003 +0000 @@ -232,9 +232,9 @@ int (*send_im)(GaimConnection *, const char *who, const char *message, int len, int away); void (*set_info)(GaimConnection *, const char *info); - int (*send_typing)(GaimConnection *, char *name, int typing); + int (*send_typing)(GaimConnection *, const char *name, int typing); void (*get_info)(GaimConnection *, const char *who); - void (*set_away)(GaimConnection *, char *state, char *message); + void (*set_away)(GaimConnection *, const char *state, const char *message); void (*get_away)(GaimConnection *, const char *who); void (*set_dir)(GaimConnection *, const char *first, const char *middle, const char *last, @@ -251,7 +251,8 @@ const char *new_pass); void (*add_buddy)(GaimConnection *, const char *name); void (*add_buddies)(GaimConnection *, GList *buddies); - void (*remove_buddy)(GaimConnection *, char *name, char *group); + void (*remove_buddy)(GaimConnection *, const char *name, + const char *group); void (*remove_buddies)(GaimConnection *, GList *buddies, const char *group); void (*add_permit)(GaimConnection *, const char *name); @@ -259,22 +260,22 @@ void (*rem_permit)(GaimConnection *, const char *name); void (*rem_deny)(GaimConnection *, const char *name); void (*set_permit_deny)(GaimConnection *); - void (*warn)(GaimConnection *, char *who, int anonymous); + void (*warn)(GaimConnection *, const char *who, int anonymous); void (*join_chat)(GaimConnection *, GHashTable *components); void (*chat_invite)(GaimConnection *, int id, const char *who, const char *message); void (*chat_leave)(GaimConnection *, int id); void (*chat_whisper)(GaimConnection *, int id, - char *who, char *message); - int (*chat_send)(GaimConnection *, int id, char *message); + const char *who, const char *message); + int (*chat_send)(GaimConnection *, int id, const char *message); void (*keepalive)(GaimConnection *); /* new user registration */ void (*register_user)(GaimAccount *); /* get "chat buddy" info and away message */ - void (*get_cb_info)(GaimConnection *, int, char *who); - void (*get_cb_away)(GaimConnection *, int, char *who); + void (*get_cb_info)(GaimConnection *, int, const char *who); + void (*get_cb_away)(GaimConnection *, int, const char *who); /* save/store buddy's alias on server list/roster */ void (*alias_buddy)(GaimConnection *, const char *who, @@ -291,7 +292,7 @@ void (*buddy_free)(struct buddy *); /* this is really bad. */ - void (*convo_closed)(GaimConnection *, char *who); + void (*convo_closed)(GaimConnection *, const char *who); char *(*normalize)(const char *);
--- a/src/server.c Tue Jul 08 02:33:17 2003 +0000 +++ b/src/server.c Tue Jul 08 03:36:41 2003 +0000 @@ -169,7 +169,7 @@ * typing notifications. * if it returns zero, it will not send any more typing notifications * typing is a flag - TRUE for typing, FALSE for stopped typing */ -int serv_send_typing(GaimConnection *g, char *name, int typing) { +int serv_send_typing(GaimConnection *g, const char *name, int typing) { GaimPluginProtocolInfo *prpl_info = NULL; if (g != NULL && g->prpl != NULL) @@ -186,9 +186,9 @@ time_t sent_away; }; -struct queued_away_response *find_queued_away_response_by_name(char *name); +struct queued_away_response *find_queued_away_response_by_name(const char *name); -int serv_send_im(GaimConnection *gc, char *name, char *message, +int serv_send_im(GaimConnection *gc, const char *name, const char *message, int len, int flags) { GaimConversation *c; @@ -229,7 +229,7 @@ return val; } -void serv_get_info(GaimConnection *g, char *name) +void serv_get_info(GaimConnection *g, const char *name) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -251,7 +251,7 @@ prpl_info->get_away(g, name); } -void serv_get_dir(GaimConnection *g, char *name) +void serv_get_dir(GaimConnection *g, const char *name) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -293,7 +293,7 @@ } -void serv_set_away(GaimConnection *gc, char *state, char *message) +void serv_set_away(GaimConnection *gc, const char *state, const char *message) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -333,7 +333,7 @@ system_log(log_away, gc, NULL, OPT_LOG_BUDDY_AWAY | OPT_LOG_MY_SIGNON); } -void serv_set_away_all(char *message) +void serv_set_away_all(const char *message) { GList *c; GaimConnection *g; @@ -402,7 +402,7 @@ } -void serv_remove_buddy(GaimConnection *g, char *name, char *group) +void serv_remove_buddy(GaimConnection *g, const char *name, const char *group) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -413,7 +413,7 @@ prpl_info->remove_buddy(g, name, group); } -void serv_remove_buddies(GaimConnection *gc, GList *g, char *group) +void serv_remove_buddies(GaimConnection *gc, GList *g, const char *group) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -590,7 +590,7 @@ prpl_info->set_idle(g, time); } -void serv_warn(GaimConnection *g, char *name, int anon) +void serv_warn(GaimConnection *g, const char *name, int anon) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -643,7 +643,7 @@ prpl_info->chat_leave(g, id); } -void serv_chat_whisper(GaimConnection *g, int id, char *who, char *message) +void serv_chat_whisper(GaimConnection *g, int id, const char *who, const char *message) { GaimPluginProtocolInfo *prpl_info = NULL; @@ -654,7 +654,7 @@ prpl_info->chat_whisper(g, id, who, message); } -int serv_chat_send(GaimConnection *g, int id, char *message) +int serv_chat_send(GaimConnection *g, int id, const char *message) { int val = -EINVAL; GaimPluginProtocolInfo *prpl_info = NULL; @@ -721,7 +721,7 @@ return i; } -struct queued_away_response *find_queued_away_response_by_name(char *name) +struct queued_away_response *find_queued_away_response_by_name(const char *name) { GSList *templist; struct queued_away_response *qar; @@ -1349,8 +1349,8 @@ gaim_conversation_destroy(conv); } -void serv_got_chat_in(GaimConnection *g, int id, char *who, - int whisper, char *message, time_t mtime) +void serv_got_chat_in(GaimConnection *g, int id, const char *who, + int whisper, const char *message, time_t mtime) { int w; GSList *bcs; @@ -1412,8 +1412,6 @@ gaim_chat_write(chat, who, buf, w, mtime); - g_free(who); - g_free(message); g_free(buf); } @@ -1426,7 +1424,7 @@ gtk_widget_destroy(window); } -void serv_got_popup(char *msg, char *u, int wid, int hei) +void serv_got_popup(const char *msg, const char *u, int wid, int hei) { GtkWidget *window; GtkWidget *vbox;
--- a/src/server.h Tue Jul 08 02:33:17 2003 +0000 +++ b/src/server.h Tue Jul 08 03:36:41 2003 +0000 @@ -53,25 +53,25 @@ void serv_login(GaimAccount *); void serv_close(GaimConnection *); void serv_touch_idle(GaimConnection *); -int serv_send_im(GaimConnection *, char *, char *, int, int); -void serv_get_info(GaimConnection *, char *); -void serv_get_dir(GaimConnection *, char *); +int serv_send_im(GaimConnection *, const char *, const char *, int, int); +void serv_get_info(GaimConnection *, const char *); +void serv_get_dir(GaimConnection *, const char *); void serv_set_idle(GaimConnection *, int); void serv_set_info(GaimConnection *, const char *); -void serv_set_away(GaimConnection *, char *, char *); -void serv_set_away_all(char *); -int serv_send_typing(GaimConnection *, char *, int); +void serv_set_away(GaimConnection *, const char *, const char *); +void serv_set_away_all(const char *); +int serv_send_typing(GaimConnection *, const char *, int); void serv_change_passwd(GaimConnection *, const char *, const char *); void serv_add_buddy(GaimConnection *, const char *); void serv_add_buddies(GaimConnection *, GList *); -void serv_remove_buddy(GaimConnection *, char *, char *); -void serv_remove_buddies(GaimConnection *, GList *, char *); +void serv_remove_buddy(GaimConnection *, const char *, const char *); +void serv_remove_buddies(GaimConnection *, GList *, const char *); void serv_add_permit(GaimConnection *, const char *); void serv_add_deny(GaimConnection *, const char *); void serv_rem_permit(GaimConnection *, const char *); void serv_rem_deny(GaimConnection *, const char *); void serv_set_permit_deny(GaimConnection *); -void serv_warn(GaimConnection *, char *, int); +void serv_warn(GaimConnection *, const char *, int); void serv_set_dir(GaimConnection *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int); @@ -81,9 +81,9 @@ void serv_join_chat(GaimConnection *, GHashTable *); void serv_chat_invite(GaimConnection *, int, const char *, const char *); void serv_chat_leave(GaimConnection *, int); -void serv_chat_whisper(GaimConnection *, int, char *, char *); -int serv_chat_send(GaimConnection *, int, char *); -void serv_got_popup(char *, char *, int, int); +void serv_chat_whisper(GaimConnection *, int, const char *, const char *); +int serv_chat_send(GaimConnection *, int, const char *); +void serv_got_popup(const char *, const char *, int, int); void serv_get_away(GaimConnection *, const char *); void serv_alias_buddy(struct buddy *); void serv_got_alias(GaimConnection *gc, const char *who, const char *alias); @@ -105,8 +105,8 @@ GaimConversation *serv_got_joined_chat(GaimConnection *gc, int id, const char *name); void serv_got_chat_left(GaimConnection *g, int id); -void serv_got_chat_in(GaimConnection *g, int id, char *who, - int whisper, char *message, time_t mtime); +void serv_got_chat_in(GaimConnection *g, int id, const char *who, + int whisper, const char *message, time_t mtime); #ifdef __cplusplus }