comparison mcabber/src/commands.c @ 1055:6eb1efea75d0

PGP: Visual encryption flag
author Mikael Berthe <mikael@lilotux.net>
date Mon, 27 Nov 2006 23:39:40 +0100
parents ea71d31a2607
children c0d44a9a99bc
comparison
equal deleted inserted replaced
1054:082d55152a25 1055:6eb1efea75d0
293 // Write the message in the buddy's window and send the message on 293 // Write the message in the buddy's window and send the message on
294 // the network. 294 // the network.
295 static void send_message(const char *msg, const char *subj) 295 static void send_message(const char *msg, const char *subj)
296 { 296 {
297 const char *jid; 297 const char *jid;
298 guint crypted;
298 299
299 if (!jb_getonline()) { 300 if (!jb_getonline()) {
300 scr_LogPrint(LPRINT_NORMAL, "You are not connected."); 301 scr_LogPrint(LPRINT_NORMAL, "You are not connected.");
301 return; 302 return;
302 } 303 }
310 if (!jid) { 311 if (!jid) {
311 scr_LogPrint(LPRINT_NORMAL, "No buddy is currently selected."); 312 scr_LogPrint(LPRINT_NORMAL, "No buddy is currently selected.");
312 return; 313 return;
313 } 314 }
314 315
316 // Network part
317 jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy)), subj, NULL,
318 &crypted);
319
320 // Hook
315 if (buddy_gettype(BUDDATA(current_buddy)) != ROSTER_TYPE_ROOM) { 321 if (buddy_gettype(BUDDATA(current_buddy)) != ROSTER_TYPE_ROOM) {
316 // local part (UI, logging, etc.) 322 // local part (UI, logging, etc.)
317 gchar *hmsg; 323 gchar *hmsg;
318 if (subj) 324 if (subj)
319 hmsg = g_strdup_printf("[%s]\n%s", subj, msg); 325 hmsg = g_strdup_printf("[%s]\n%s", subj, msg);
320 else 326 else
321 hmsg = (char*)msg; 327 hmsg = (char*)msg;
322 hk_message_out(jid, NULL, 0, hmsg); 328 hk_message_out(jid, NULL, 0, hmsg, crypted);
323 if (hmsg != msg) g_free(hmsg); 329 if (hmsg != msg) g_free(hmsg);
324 } 330 }
325
326 // Network part
327 jb_send_msg(jid, msg, buddy_gettype(BUDDATA(current_buddy)), subj, NULL);
328 } 331 }
329 332
330 // process_command(line) 333 // process_command(line)
331 // Process a command line. 334 // Process a command line.
332 // Return 255 if this is the /quit command, and 0 for the other commands. 335 // Return 255 if this is the /quit command, and 0 for the other commands.
900 903
901 static int send_message_to(const char *jid, const char *msg, const char *subj) 904 static int send_message_to(const char *jid, const char *msg, const char *subj)
902 { 905 {
903 char *bare_jid, *rp; 906 char *bare_jid, *rp;
904 char *hmsg; 907 char *hmsg;
908 guint crypted;
905 909
906 if (!jid || !*jid) { 910 if (!jid || !*jid) {
907 scr_LogPrint(LPRINT_NORMAL, "You must specify a Jabber ID."); 911 scr_LogPrint(LPRINT_NORMAL, "You must specify a Jabber ID.");
908 return 1; 912 return 1;
909 } 913 }
935 if (subj) 939 if (subj)
936 hmsg = g_strdup_printf("[%s]\n%s", subj, msg); 940 hmsg = g_strdup_printf("[%s]\n%s", subj, msg);
937 else 941 else
938 hmsg = (char*)msg; 942 hmsg = (char*)msg;
939 943
940 hk_message_out(bare_jid, rp, 0, hmsg); 944 // Network part
945 jb_send_msg(jid, msg, ROSTER_TYPE_USER, subj, NULL, &crypted);
946
947 // Hook
948 hk_message_out(bare_jid, rp, 0, hmsg, crypted);
941 if (hmsg != msg) g_free(hmsg); 949 if (hmsg != msg) g_free(hmsg);
942
943 // Network part
944 jb_send_msg(jid, msg, ROSTER_TYPE_USER, subj, NULL);
945 950
946 if (rp) g_free(bare_jid); 951 if (rp) g_free(bare_jid);
947 return 0; 952 return 0;
948 } 953 }
949 954
2045 } 2050 }
2046 2051
2047 arg = to_utf8(arg); 2052 arg = to_utf8(arg);
2048 // Set the topic 2053 // Set the topic
2049 msg = g_strdup_printf("%s has set the topic to: %s", mkcmdstr("me"), arg); 2054 msg = g_strdup_printf("%s has set the topic to: %s", mkcmdstr("me"), arg);
2050 jb_send_msg(buddy_getjid(bud), msg, ROSTER_TYPE_ROOM, arg, NULL); 2055 jb_send_msg(buddy_getjid(bud), msg, ROSTER_TYPE_ROOM, arg, NULL, NULL);
2051 g_free(arg); 2056 g_free(arg);
2052 g_free(msg); 2057 g_free(msg);
2053 } 2058 }
2054 2059
2055 static void room_destroy(gpointer bud, char *arg) 2060 static void room_destroy(gpointer bud, char *arg)