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