@@ -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
}
@@ -2086,6 +2087,8 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2086
2087
GList *field;
2087
2088
int topicId = -1 ;
2088
2089
int usersId = -1 ;
2090
+ int descriptionId = -1 ;
2091
+ int roomId = -1 ;
2089
2092
int id = 0 ;
2090
2093
for (field = fields; field != NULL ; field = field->next , id++) {
2091
2094
PurpleRoomlistField *f = (PurpleRoomlistField *) field->data ;
@@ -2100,12 +2103,18 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2100
2103
continue ;
2101
2104
}
2102
2105
std::string fstring = f->name ;
2103
- if (fstring == " topic" || fstring == " description" ) {
2106
+ if (fstring == " id" ) {
2107
+ roomId = id;
2108
+ }
2109
+ else if (fstring == " topic" || fstring == " name" ) {
2104
2110
topicId = id;
2105
2111
}
2106
2112
else if (fstring == " users" ) {
2107
2113
usersId = id;
2108
2114
}
2115
+ else if (fstring == " type" ) {
2116
+ descriptionId = id;
2117
+ }
2109
2118
else {
2110
2119
LOG4CXX_INFO (logger, " Unknown RoomList field " << fstring);
2111
2120
}
@@ -2117,37 +2126,64 @@ static void RoomlistProgress(PurpleRoomlist *list, gboolean in_progress)
2117
2126
PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO (plugin);
2118
2127
for (rooms = list->rooms ; rooms != NULL ; rooms = rooms->next ) {
2119
2128
PurpleRoomlistRoom *room = (PurpleRoomlistRoom *)rooms->data ;
2120
- if (room->type == PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) continue ;
2121
- std::string roomId = prpl_info && prpl_info->roomlist_room_serialize ?
2122
- prpl_info->roomlist_room_serialize (room)
2123
- : room->name ;
2124
- np->m_rooms [np->m_accounts [list->account ]].push_back (roomId);
2129
+
2130
+ std::string roomIdentifier = room->name ;
2131
+ if (roomId != -1 ) {
2132
+ char *roomIdField = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), roomId);
2133
+ if (roomIdField) {
2134
+ roomIdentifier = std::string (roomIdField);
2135
+ }
2136
+ }
2137
+ np->m_rooms [np->m_accounts [list->account ]].push_back (roomIdentifier);
2138
+
2139
+ std::string roomName = " " ;
2140
+ int nestedLevel = 0 ;
2141
+ PurpleRoomlistRoom *parentRoom = purple_roomlist_room_get_parent (room);
2142
+ while (parentRoom != NULL ) {
2143
+ nestedLevel++;
2144
+ parentRoom = purple_roomlist_room_get_parent (parentRoom);
2145
+ }
2146
+
2147
+ if (nestedLevel > 0 ) {
2148
+ std::string roomNamePrefix = std::string (nestedLevel, ' -' );
2149
+ if (roomNamePrefix != " " ) {
2150
+ roomNamePrefix = roomNamePrefix + " > " ;
2151
+ }
2152
+ roomName = roomNamePrefix;
2153
+ }
2125
2154
2126
2155
if (topicId == -1 ) {
2127
- m_topics. push_back ( room->name ) ;
2156
+ roomName += room->name ;
2128
2157
}
2129
2158
else {
2130
2159
char *topic = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), topicId);
2131
2160
if (topic) {
2132
- m_topics. push_back ( topic) ;
2161
+ roomName += topic;
2133
2162
}
2134
- else {
2135
- if (usersId) {
2136
- char *users = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), usersId);
2137
- if (users) {
2138
- m_topics.push_back (users);
2139
- }
2140
- else {
2141
- LOG4CXX_WARN (logger, " RoomList topic and users is NULL" );
2142
- m_topics.push_back (room->name );
2143
- }
2163
+ else if (usersId) {
2164
+ char *users = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), usersId);
2165
+ if (users) {
2166
+ roomName += users;
2144
2167
}
2145
2168
else {
2146
- LOG4CXX_WARN (logger, " RoomList topic is NULL" );
2147
- m_topics. push_back ( room->name ) ;
2169
+ LOG4CXX_WARN (logger, " RoomList topic and users is NULL" );
2170
+ roomName += room->name ;
2148
2171
}
2149
2172
}
2173
+ else {
2174
+ LOG4CXX_WARN (logger, " RoomList topic is NULL" );
2175
+ roomName += room->name ;
2176
+ }
2177
+ }
2178
+
2179
+ if (descriptionId != -1 ) {
2180
+ char *description = (char *) g_list_nth_data (purple_roomlist_room_get_fields (room), descriptionId);
2181
+ if (description) {
2182
+ roomName += " (" + std::string (description) + " )" ;
2183
+ }
2150
2184
}
2185
+
2186
+ m_topics.push_back (roomName);
2151
2187
}
2152
2188
2153
2189
std::string user = " " ;
0 commit comments