After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 542176 - EmpathyChatroomManager doesn't contain active chat rooms
EmpathyChatroomManager doesn't contain active chat rooms
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
0.23.x
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks: 496100
 
 
Reported: 2008-07-09 09:50 UTC by Guillaume Desmottes
Modified: 2008-10-13 08:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
diff between master and my branch (6.95 KB, patch)
2008-07-09 15:35 UTC, Guillaume Desmottes
none Details | Review
the new diff (50.71 KB, patch)
2008-09-20 16:35 UTC, Guillaume Desmottes
none Details | Review

Description Guillaume Desmottes 2008-07-09 09:50:19 UTC
EmpathyChatroomManager should contain active chatrooms.
Comment 1 Guillaume Desmottes 2008-07-09 12:19:30 UTC
I'm working on it.
Comment 3 Guillaume Desmottes 2008-07-09 15:35:30 UTC
Created attachment 114257 [details] [review]
diff between master and my branch
Comment 4 Xavier Claessens 2008-07-19 10:09:50 UTC
Thanks for the patch, some comments:

1) Coding style of course, but you can fix that when the rest is OK.

2) Do we want to keep favorite rooms that are not auto-connect? xchat-gnome only keep auto-connect rooms and forget about others AFAIK. I think a room should be kept in the xml if and only if it is auto-connect. Do you agree?

3) chatroom_invalidated_cb() --> static functions of empathy_foo start with foo_. Also the chatroom should be kept if it is auto-connect? Or auto-connect implies favorite==true?

4) EmpathyChatroomManager is a singleton, if you call empathy_chatroom_new for the first time it gets created and if you unref later it get finalized if nobody else reffed it. I think it's safer if EmpathyDispatcher always keep a ref to the chatroom manager to avoid possible construction/destruction each time a new room channel appear.

5) Prevent chatroom_manager_file_save() to be called if a non-favorite chatroom is added/removed. Also it should be called when a chatroom become favorite or is not favorite anymore. In fact empathy_chatroom_manager_store should be removed and the manager should keep track itself of changes of one of its chatroom and rewrite the xml file in a timeout cb to avoid rewriting too often.

That's all I see for now.
Comment 5 Guillaume Desmottes 2008-08-24 22:31:29 UTC
I rebased my branch on top of master and added it to Monkey: http://monkey.collabora.co.uk/empathy.git_chatroom-mgr/

2) No, I think it's worth to be able to have not-autoconnect rooms in the manager. Furthermore, that's already implemented so why remove this feature?

3) I don't really see the point of this namespacing but I renamed it to dispatcher_chatroom_invalidated_cb.
Yes, autoconnect implies favorite.

4) done

I'll fix 5) later
Comment 6 Guillaume Desmottes 2008-09-20 16:35:04 UTC
New version of my patch fixing the review comments and adding a nice test framework.

Monkey: http://monkey.collabora.co.uk/empathy.git_chatroom-mgr-rebased/
Branch: http://git.collabora.co.uk/?p=user/cassidy/empathy.git;a=shortlog;h=refs/heads/chatroom-mgr-rebased
Comment 7 Guillaume Desmottes 2008-09-20 16:35:42 UTC
Created attachment 119043 [details] [review]
the new diff
Comment 8 Xavier Claessens 2008-10-03 13:53:05 UTC
Thanks for the patch, some comments:

1) in chatroom-manager.c, add_chatroom(): Instead of connecting each "notify::foo" signals separately you can just connect to "notify". In the callback you should reset timout only if it's a favorite, right?

2) In empathy_chatroom_set_auto_connect(): When set auto-connect to TRUE it changes the favorite property to TRUE. That's fine but g_object_notify() should be called for that property too.

3) In dispatcher_connection_new_channel_cb(): empathy_chatroom_manager_find() does not return a new ref, so you should not unref the chatroom.

4) tests does not compile, you can't ignore the return value of system() calls. I get that error from gcc: check-empathy-chatroom-manager.c:103: error: ignoring return value of ‘system’, declared with attribute warn_unused_result.

5) python binding does not build but I'll update them myself, it it just a matter of running some automated scripts :)

Otherwise it's OK. I didn't review tests but if they all succeed it's fine :)
Comment 9 Guillaume Desmottes 2008-10-04 10:07:04 UTC
1) done.
Humm no, because if a chatroom which was a favorite is not one anymore, we have to update the XML (to remove it).

2) Good point. fixed.

3) Actually, I unref it at the end to remove the ref I added when creating the object (or if I didn't create one, I manually ref it). I could avoid that and use a created boolean and unref only if I created the object.

4) humm, I don't have this problem on Gutsy. Should be fixed.

5) Shouldn't we automatically run these scripts when source is changed ?
Comment 10 Xavier Claessens 2008-10-06 09:20:53 UTC
(In reply to comment #9)
> 1) done.
> Humm no, because if a chatroom which was a favorite is not one anymore, we have
> to update the XML (to remove it).

Ah, right!

> 3) Actually, I unref it at the end to remove the ref I added when creating the
> object (or if I didn't create one, I manually ref it). I could avoid that and
> use a created boolean and unref only if I created the object.

You are right, you call g_object_ref() if chatroom is !NULL, I've read g_object_unref(). My bad :)

> 4) humm, I don't have this problem on Gutsy. Should be fixed.

You fixed only at one place. It have to be changed everywhere. Why don't you use g_spawn_command_line_async() instead of system()?

> 5) Shouldn't we automatically run these scripts when source is changed ?

No, there is still little manual stuff to do, but I should automate all that stuff so the script can be run from Makefile and we can remove all generated files from git/svn.

Comment 11 Guillaume Desmottes 2008-10-09 22:36:47 UTC
4) oups sorry fixed.
Comment 12 Guillaume Desmottes 2008-10-09 23:13:55 UTC
I pushed 2 more commits in http://git.collabora.co.uk/?p=user/cassidy/empathy.git;a=shortlog;h=refs/heads/chatroom-mgr-rebased
fixing a crasher.
Comment 13 Xavier Claessens 2008-10-13 08:12:35 UTC
Merged, thanks !