@@ -854,7 +854,8 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
854
854
else if (PURPLE_PLUGIN_PROTOCOL_INFO (gc->prpl )->chat_info_defaults != NULL ) {
855
855
if (CONFIG_STRING (config, " service.protocol" ) == " prpl-jabber" ) {
856
856
comps = PURPLE_PLUGIN_PROTOCOL_INFO (gc->prpl )->chat_info_defaults (gc, (roomName + " /" + nickname).c_str ());
857
- } else {
857
+ }
858
+ else {
858
859
comps = PURPLE_PLUGIN_PROTOCOL_INFO (gc->prpl )->chat_info_defaults (gc, roomName.c_str ());
859
860
}
860
861
}
@@ -2110,6 +2111,8 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2110
2111
GList *field;
2111
2112
int topicId = -1 ;
2112
2113
int usersId = -1 ;
2114
+ int descriptionId = -1 ;
2115
+ int roomId = -1 ;
2113
2116
int id = 0 ;
2114
2117
for (field = fields; field != NULL ; field = field->next , id++) {
2115
2118
PurpleRoomlistField *f = (PurpleRoomlistField *) field->data ;
@@ -2124,12 +2127,18 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2124
2127
continue ;
2125
2128
}
2126
2129
std::string fstring = f->name ;
2127
- if (fstring == " topic" || fstring == " description" ) {
2130
+ if (fstring == " id" ) {
2131
+ roomId = id;
2132
+ }
2133
+ else if (fstring == " topic" || fstring == " name" || fstring == " description" ) {
2128
2134
topicId = id;
2129
2135
}
2130
2136
else if (fstring == " users" ) {
2131
2137
usersId = id;
2132
2138
}
2139
+ else if (fstring == " type" ) {
2140
+ descriptionId = id;
2141
+ }
2133
2142
else {
2134
2143
LOG4CXX_INFO (logger, " Unknown RoomList field " << fstring);
2135
2144
}
@@ -2141,37 +2150,64 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2141
2150
PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO (plugin);
2142
2151
for (rooms = list->rooms ; rooms != NULL ; rooms = rooms->next ) {
2143
2152
PurpleRoomlistRoom *room = (PurpleRoomlistRoom *)rooms->data ;
2144
- if (room->type == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) continue ;
2145
- std::string roomId = prpl_info && prpl_info->roomlist_room_serialize ?
2146
- prpl_info->roomlist_room_serialize (room)
2147
- : room->name ;
2148
- np->m_rooms [np->m_accounts [list->account ]].push_back (roomId);
2153
+
2154
+ std::string roomIdentifier = room->name ;
2155
+ if (roomId != -1 ) {
2156
+ char *roomIdField = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), roomId);
2157
+ if (roomIdField) {
2158
+ roomIdentifier = std::string (roomIdField);
2159
+ }
2160
+ }
2161
+ np->m_rooms [np->m_accounts [list->account ]].push_back (roomIdentifier);
2162
+
2163
+ std::string roomName = " " ;
2164
+ int nestedLevel = 0 ;
2165
+ PurpleRoomlistRoom *parentRoom = purple_roomlist_room_get_parent (room);
2166
+ while (parentRoom != NULL ) {
2167
+ nestedLevel++;
2168
+ parentRoom = purple_roomlist_room_get_parent (parentRoom);
2169
+ }
2170
+
2171
+ if (nestedLevel > 0 ) {
2172
+ std::string roomNamePrefix = std::string (nestedLevel, ' -' );
2173
+ if (roomNamePrefix != " " ) {
2174
+ roomNamePrefix = roomNamePrefix + " > " ;
2175
+ }
2176
+ roomName = roomNamePrefix;
2177
+ }
2149
2178
2150
2179
if (topicId == -1 ) {
2151
- m_topics. push_back ( room->name ) ;
2180
+ roomName += room->name ;
2152
2181
}
2153
2182
else {
2154
2183
char *topic = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), topicId);
2155
2184
if (topic) {
2156
- m_topics. push_back ( topic) ;
2185
+ roomName += topic;
2157
2186
}
2158
- else {
2159
- if (usersId) {
2160
- char *users = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), usersId);
2161
- if (users) {
2162
- m_topics.push_back (users);
2163
- }
2164
- else {
2165
- LOG4CXX_WARN (logger, " RoomList topic and users is NULL" );
2166
- m_topics.push_back (room->name );
2167
- }
2187
+ else if (usersId) {
2188
+ char *users = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), usersId);
2189
+ if (users) {
2190
+ roomName += users;
2168
2191
}
2169
2192
else {
2170
- LOG4CXX_WARN (logger, " RoomList topic is NULL" );
2171
- m_topics. push_back ( room->name ) ;
2193
+ LOG4CXX_WARN (logger, " RoomList topic and users is NULL" );
2194
+ roomName += room->name ;
2172
2195
}
2173
2196
}
2197
+ else {
2198
+ LOG4CXX_WARN (logger, " RoomList topic is NULL" );
2199
+ roomName += room->name ;
2200
+ }
2201
+ }
2202
+
2203
+ if (descriptionId != -1 ) {
2204
+ char *description = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), descriptionId);
2205
+ if (description) {
2206
+ roomName += " (" + std::string (description) + " )" ;
2207
+ }
2174
2208
}
2209
+
2210
+ m_topics.push_back (roomName);
2175
2211
}
2176
2212
2177
2213
std::string user = " " ;
0 commit comments