--- a/mcabber/src/commands.c Sun Dec 03 12:00:17 2006 +0100
+++ b/mcabber/src/commands.c Sun Dec 03 19:29:50 2006 +0100
@@ -1282,7 +1282,7 @@
buffer = g_new(char, 4096);
if (bjid) {
- GSList *resources;
+ GSList *resources, *p_res;
char *bstr = "unknown";
// Enter chat mode
@@ -1320,21 +1320,21 @@
scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO);
}
}
- for ( ; resources ; resources = g_slist_next(resources) ) {
+ for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
gchar rprio;
enum imstatus rstatus;
const char *rst_msg;
time_t rst_time;
struct pgp_data *rpgp;
- rprio = buddy_getresourceprio(bud, resources->data);
- rstatus = buddy_getstatus(bud, resources->data);
- rst_msg = buddy_getstatusmsg(bud, resources->data);
- rst_time = buddy_getstatustime(bud, resources->data);
- rpgp = buddy_resource_pgp(bud, resources->data);
+ rprio = buddy_getresourceprio(bud, p_res->data);
+ rstatus = buddy_getstatus(bud, p_res->data);
+ rst_msg = buddy_getstatusmsg(bud, p_res->data);
+ rst_time = buddy_getstatustime(bud, p_res->data);
+ rpgp = buddy_resource_pgp(bud, p_res->data);
snprintf(buffer, 4095, "Resource: [%c] (%d) %s", imstatus2char[rstatus],
- rprio, (char*)resources->data);
+ rprio, (char*)p_res->data);
scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO);
if (rst_msg) {
snprintf(buffer, 4095, "Status message: %s", rst_msg);
@@ -1360,7 +1360,9 @@
}
}
#endif
+ g_free(p_res->data);
}
+ g_slist_free(resources);
} else {
if (name) scr_LogPrint(LPRINT_NORMAL, "Name: %s", name);
scr_LogPrint(LPRINT_NORMAL, "Type: %s",
@@ -1390,7 +1392,7 @@
{
const char *bjid;
char *buffer;
- GSList *resources;
+ GSList *resources, *p_res;
if (*arg) {
scr_LogPrint(LPRINT_NORMAL, "This action does not require a parameter.");
@@ -1408,22 +1410,23 @@
scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO);
resources = buddy_getresources(bud);
- for ( ; resources ; resources = g_slist_next(resources) ) {
+ for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
enum imstatus rstatus;
const char *rst_msg;
- rstatus = buddy_getstatus(bud, resources->data);
- rst_msg = buddy_getstatusmsg(bud, resources->data);
+ rstatus = buddy_getstatus(bud, p_res->data);
+ rst_msg = buddy_getstatusmsg(bud, p_res->data);
snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus],
- (char*)resources->data);
+ (char*)p_res->data);
scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO);
if (rst_msg) {
snprintf(buffer, 4095, "Status message: %s", rst_msg);
scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_NONE);
}
+ g_free(p_res->data);
}
-
+ g_slist_free(resources);
g_free(buffer);
}
--- a/mcabber/src/jabglue.c Sun Dec 03 12:00:17 2006 +0100
+++ b/mcabber/src/jabglue.c Sun Dec 03 19:29:50 2006 +0100
@@ -998,7 +998,7 @@
void jb_request(const char *fjid, enum iqreq_type reqtype)
{
- GSList *resources;
+ GSList *resources, *p_res;
GSList *roster_elt;
void (*request_fn)(const char *);
const char *strreqtype;
@@ -1049,13 +1049,15 @@
(*request_fn)(fjid); // Let's send a request anyway...
scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid);
}
- for ( ; resources ; resources = g_slist_next(resources) ) {
+ for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
gchar *fulljid;
- fulljid = g_strdup_printf("%s/%s", fjid, (char*)resources->data);
+ fulljid = g_strdup_printf("%s/%s", fjid, (char*)p_res->data);
(*request_fn)(fulljid);
scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fulljid);
g_free(fulljid);
+ g_free(p_res->data);
}
+ g_slist_free(resources);
}
// Join a MUC room
--- a/mcabber/src/screen.c Sun Dec 03 12:00:17 2006 +0100
+++ b/mcabber/src/screen.c Sun Dec 03 19:29:50 2006 +0100
@@ -1075,9 +1075,14 @@
// No status message for groups & MUC rooms
if (!isgrp && !ismuc) {
- GSList *resources = buddy_getresources(BUDDATA(current_buddy));
+ GSList *resources, *p_res;
+ resources = buddy_getresources(BUDDATA(current_buddy));
msg = buddy_getstatusmsg(BUDDATA(current_buddy),
resources ? resources->data : "");
+ // Free the resources list data
+ for (p_res = resources ; p_res ; p_res = g_slist_next(p_res))
+ g_free(p_res->data);
+ g_slist_free(resources);
} else if (ismuc) {
msg = buddy_gettopic(BUDDATA(current_buddy));
}
@@ -1200,7 +1205,7 @@
for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) {
unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe;
gchar *rline_locale;
- GSList *resources;
+ GSList *resources, *p_res;
bflags = buddy_getflags(BUDDATA(buddy));
btype = buddy_gettype(BUDDATA(buddy));
@@ -1220,16 +1225,16 @@
pending = ' ';
resources = buddy_getresources(BUDDATA(buddy));
- for ( ; resources ; resources = g_slist_next(resources) ) {
+ for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
guint events = buddy_resource_getevents(BUDDATA(buddy),
- resources ? resources->data : "");
- if (events & ROSTER_EVENT_PAUSED)
+ p_res ? p_res->data : "");
+ if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
pending = '.';
- if (events & ROSTER_EVENT_COMPOSING) {
+ if (events & ROSTER_EVENT_COMPOSING)
pending = '+';
- break;
- }
+ g_free(p_res->data);
}
+ g_slist_free(resources);
// Display message notice if there is a message flag, but not
// for unfolded groups.