comparison src/protocols/silc/chat.c @ 9353:b8138f3959dc

[gaim-migrate @ 10161] Stu Tomlinson's bug fixes for SILC from bug #975859 committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Tue, 22 Jun 2004 21:12:31 +0000
parents 3313eab5033d
children 43741d8f76f7
comparison
equal deleted inserted replaced
9352:cc2baf349805 9353:b8138f3959dc
1001 g_list_free(users); 1001 g_list_free(users);
1002 1002
1003 /* Set topic */ 1003 /* Set topic */
1004 if (channel->topic) 1004 if (channel->topic)
1005 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, channel->topic); 1005 gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, channel->topic);
1006
1007 /* Set nick */
1008 gaim_conv_chat_set_nick(GAIM_CONV_CHAT(convo), conn->local_entry->nickname);
1006 } 1009 }
1007 1010
1008 void silcgaim_chat_join(GaimConnection *gc, GHashTable *data) 1011 void silcgaim_chat_join(GaimConnection *gc, GHashTable *data)
1009 { 1012 {
1010 SilcGaim sg = gc->proto_data; 1013 SilcGaim sg = gc->proto_data;
1128 return; 1131 return;
1129 1132
1130 /* Call INVITE */ 1133 /* Call INVITE */
1131 silc_client_command_call(client, conn, NULL, "INVITE", 1134 silc_client_command_call(client, conn, NULL, "INVITE",
1132 chu->channel->channel_name, 1135 chu->channel->channel_name,
1133 name); 1136 name, NULL);
1134 } 1137 }
1135 1138
1136 void silcgaim_chat_leave(GaimConnection *gc, int id) 1139 void silcgaim_chat_leave(GaimConnection *gc, int id)
1137 { 1140 {
1138 SilcGaim sg = gc->proto_data; 1141 SilcGaim sg = gc->proto_data;
1211 SilcChannelUser chu; 1214 SilcChannelUser chu;
1212 SilcChannelEntry channel = NULL; 1215 SilcChannelEntry channel = NULL;
1213 SilcChannelPrivateKey key = NULL; 1216 SilcChannelPrivateKey key = NULL;
1214 SilcUInt32 flags; 1217 SilcUInt32 flags;
1215 int ret; 1218 int ret;
1219 const char *msg2;
1216 gboolean found = FALSE; 1220 gboolean found = FALSE;
1217 gboolean sign = gaim_prefs_get_bool("/plugins/prpl/silc/sign_chat"); 1221 gboolean sign = gaim_prefs_get_bool("/plugins/prpl/silc/sign_chat");
1218 1222
1219 if (!msg || !conn) 1223 if (!msg || !conn)
1220 return 0; 1224 return 0;
1221 1225
1222 /* See if command */ 1226 flags = SILC_MESSAGE_FLAG_UTF8;
1223 if (strlen(msg) > 1 && msg[0] == '/') { 1227
1228 msg2 = msg;
1229
1230 if (!g_ascii_strncasecmp(msg2, "/me ", 4))
1231 {
1232 msg2 += 4;
1233 if (!msg2)
1234 return 0;
1235 flags |= SILC_MESSAGE_FLAG_ACTION;
1236 } else if (strlen(msg) > 1 && msg[0] == '/') {
1224 if (!silc_client_command_call(client, conn, msg + 1)) 1237 if (!silc_client_command_call(client, conn, msg + 1))
1225 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"), 1238 gaim_notify_error(gc, ("Call Command"), _("Cannot call command"),
1226 _("Unknown command")); 1239 _("Unknown command"));
1227 return 0; 1240 return 0;
1228 } 1241 }
1229 1242
1230 flags = SILC_MESSAGE_FLAG_UTF8; 1243
1231 if (sign) 1244 if (sign)
1232 flags |= SILC_MESSAGE_FLAG_SIGNED; 1245 flags |= SILC_MESSAGE_FLAG_SIGNED;
1233 1246
1234 /* Get the channel private key if we are sending on 1247 /* Get the channel private key if we are sending on
1235 private group */ 1248 private group */
1265 channel = chu->channel; 1278 channel = chu->channel;
1266 } 1279 }
1267 1280
1268 /* Send channel message */ 1281 /* Send channel message */
1269 ret = silc_client_send_channel_message(client, conn, channel, key, 1282 ret = silc_client_send_channel_message(client, conn, channel, key,
1270 flags, (unsigned char *)msg, 1283 flags, (unsigned char *)msg2,
1271 strlen(msg), TRUE); 1284 strlen(msg2), TRUE);
1272 if (ret) 1285 if (ret)
1273 serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, msg, 1286 serv_got_chat_in(gc, id, gaim_connection_get_display_name(gc), 0, msg,
1274 time(NULL)); 1287 time(NULL));
1275 1288
1276 return ret; 1289 return ret;
1283 SilcClientConnection conn = sg->conn; 1296 SilcClientConnection conn = sg->conn;
1284 SilcHashTableList htl; 1297 SilcHashTableList htl;
1285 SilcChannelUser chu; 1298 SilcChannelUser chu;
1286 gboolean found = FALSE; 1299 gboolean found = FALSE;
1287 1300
1288 if (!topic || !conn) 1301 if (!conn)
1289 return; 1302 return;
1290 1303
1291 /* See if setting topic on private group. Set it 1304 /* See if setting topic on private group. Set it
1292 on the actual channel */ 1305 on the actual channel */
1293 if (id > SILCGAIM_PRVGRP) { 1306 if (id > SILCGAIM_PRVGRP) {