-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add GroupMessage for groupchats * Add ConferenceWindow for groupchats * Add ConferenceInfoWidget to get info on a groupchat (more to come) * Refactor ToxSessionListener to use uint32 instead of uint8[] as id * Move person and group to meaningful names, make them symbolic * Make use of status icons for friends * Create a convenience functions in the vapi to avoid dealing with uint8[] inside the caller
- Loading branch information
Showing
32 changed files
with
1,458 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* GroupMessage.vala | ||
* | ||
* Copyright (C) 2018 Venom authors and contributors | ||
* | ||
* This file is part of Venom. | ||
* | ||
* Venom is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Venom is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Venom. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace Venom { | ||
public class GroupMessage : IMessage, Object { | ||
public unowned IContact contact { get; protected set; } | ||
public uint32 peer_number { get; protected set; } | ||
public string message { get; protected set; } | ||
|
||
public GLib.DateTime timestamp { get; protected set; } | ||
public MessageDirection message_direction { get; protected set; } | ||
public bool important { get; set; } | ||
public bool is_action { get; set; } | ||
public uint32 message_id { get; set; } | ||
public bool received { get; set; } | ||
|
||
private GroupMessage(IContact contact, MessageDirection direction, string message, GLib.DateTime timestamp) { | ||
this.contact = contact; | ||
this.message_direction = direction; | ||
this.message = message; | ||
this.timestamp = timestamp; | ||
this.important = false; | ||
this.is_action = false; | ||
} | ||
|
||
public GroupMessage.outgoing(IContact contact, string message, GLib.DateTime timestamp = new GLib.DateTime.now_local()) { | ||
this(contact, MessageDirection.OUTGOING, message, timestamp); | ||
} | ||
|
||
public GroupMessage.incoming(IContact contact, uint32 peer_number, string message, GLib.DateTime timestamp = new GLib.DateTime.now_local()) { | ||
this(contact, MessageDirection.INCOMING, message, timestamp); | ||
this.peer_number = peer_number; | ||
} | ||
|
||
public virtual string get_sender_plain() { | ||
if (message_direction == MessageDirection.OUTGOING) { | ||
return User.instance.name; | ||
} else { | ||
return "peer %u".printf(peer_number); | ||
} | ||
} | ||
|
||
public virtual string get_message_plain() { | ||
return message; | ||
} | ||
|
||
public virtual string get_time_plain() { | ||
var now = new DateTime.now_local(); | ||
if (now.difference(timestamp) > GLib.TimeSpan.DAY) { | ||
return timestamp.format("%c"); | ||
} else { | ||
return timestamp.format("%X"); | ||
} | ||
} | ||
|
||
public Gdk.Pixbuf get_sender_image() { | ||
return UITools.pixbuf_from_resource(R.icons.default_contact); | ||
} | ||
|
||
public bool equals_message(IMessage m) { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.