comparison mcabber/src/jabglue.c @ 489:21ab22a60bcb

Auto-convert a roster item to "room" type when receiving a groupchat message
author Mikael Berthe <mikael@lilotux.net>
date Fri, 07 Oct 2005 20:12:11 +0200
parents 2a6a8ebb813b
children dba5de0b89bc
comparison
equal deleted inserted replaced
488:9e8519078e00 489:21ab22a60bcb
676 676
677 postlogin(); 677 postlogin();
678 } 678 }
679 679
680 void gotmessage(char *type, const char *from, const char *body, 680 void gotmessage(char *type, const char *from, const char *body,
681 const char *enc, time_t timestamp) 681 const char *enc, time_t timestamp)
682 { 682 {
683 char *jid; 683 char *jid;
684 const char *rname; 684 const char *rname;
685 gchar *buffer = from_utf8(body); 685 gchar *buffer = from_utf8(body);
686 686
887 r = strchr(s, '/'); 887 r = strchr(s, '/');
888 if (r) *r++ = 0; 888 if (r) *r++ = 0;
889 else r = s; 889 else r = s;
890 // Display inside the room window 890 // Display inside the room window
891 mbuf = g_strdup_printf("%s has set the topic to: %s", r, 891 mbuf = g_strdup_printf("%s has set the topic to: %s", r,
892 (subj_noutf8 ? subj_noutf8 : "(?)")); 892 (subj_noutf8 ? subj_noutf8 : "(?)"));
893 scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO); 893 scr_WriteIncomingMessage(s, mbuf, 0, HBB_PREFIX_INFO);
894 if (settings_opt_get_int("log_muc_conf")) 894 if (settings_opt_get_int("log_muc_conf"))
895 hlog_write_message(s, 0, FALSE, mbuf); 895 hlog_write_message(s, 0, FALSE, mbuf);
896 if (subj_noutf8) g_free(subj_noutf8); 896 if (subj_noutf8) g_free(subj_noutf8);
897 g_free(s); 897 g_free(s);
1132 const char *mbnewnick = NULL; 1132 const char *mbnewnick = NULL;
1133 GSList *room_elt; 1133 GSList *room_elt;
1134 int log_muc_conf = settings_opt_get_int("log_muc_conf"); 1134 int log_muc_conf = settings_opt_get_int("log_muc_conf");
1135 1135
1136 // Add room if it doesn't already exist 1136 // Add room if it doesn't already exist
1137 room_elt = roster_add_user(r, NULL, NULL, ROSTER_TYPE_ROOM); 1137 room_elt = roster_find(r, jidsearch, 0);
1138 if (!room_elt)
1139 room_elt = roster_add_user(r, NULL, NULL, ROSTER_TYPE_ROOM);
1140 else // Make sure this is a room (it can be a conversion user->room)
1141 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM);
1138 1142
1139 // Get room member's information 1143 // Get room member's information
1140 y = xmlnode_get_tag(x, "item"); 1144 y = xmlnode_get_tag(x, "item");
1141 if (y) { 1145 if (y) {
1142 p = xmlnode_get_attrib(y, "role"); 1146 p = xmlnode_get_attrib(y, "role");