summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2018-11-08 14:12:36 (GMT)
committerEdwin Mons <edwin.mons@isode.com>2018-11-08 15:30:19 (GMT)
commit0b4e062a59613b2597b712c0106c3ed08b747637 (patch)
tree7b062a8123d37be7226d4eb36c553b04563255c6 /Swift/Controllers/UIInterfaces
parentcf3d517763a3d74a2ec9fd6f7bdee8cbaee3550f (diff)
downloadswift-0b4e062a59613b2597b712c0106c3ed08b747637.zip
swift-0b4e062a59613b2597b712c0106c3ed08b747637.tar.bz2
Change unread counters to size_t
Since the counters cannot be negative, changing the type used for unread counters to size_t seems a better fit, and it avoids the need for numeric_casts. Test-Information: Unit tests pass on macOS 10.13 Change-Id: I61badcfc410f0cce7f922da90b50ef5a809c6521
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h8
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindow.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h
index 29097e9..6aa729b 100644
--- a/Swift/Controllers/UIInterfaces/ChatListWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h
@@ -26,7 +26,7 @@ namespace Swift {
class Chat {
public:
Chat() : statusType(StatusShow::None), isMUC(false), unreadCount(0), isPrivateMessage(false) {}
- Chat(const JID& jid, const std::string& chatName, const std::string& activity, int unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, bool isPrivateMessage = false, const std::string& nick = "", const boost::optional<std::string> password = boost::optional<std::string>())
+ Chat(const JID& jid, const std::string& chatName, const std::string& activity, size_t unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, bool isPrivateMessage = false, const std::string& nick = "", const boost::optional<std::string> password = boost::optional<std::string>())
: jid(jid), chatName(chatName), activity(activity), statusType(statusType), isMUC(isMUC), nick(nick), password(password), unreadCount(unreadCount), avatarPath(avatarPath), isPrivateMessage(isPrivateMessage) {}
/** Assume that nicks and other transient features aren't important for equality */
bool operator==(const Chat& other) const {
@@ -53,7 +53,7 @@ namespace Swift {
return key_compare(inviteesNames, other.inviteesNames);
}
}
- void setUnreadCount(int unread) {
+ void setUnreadCount(size_t unread) {
unreadCount = unread;
}
void setStatusType(StatusShow::Type type) {
@@ -93,7 +93,7 @@ namespace Swift {
bool isMUC;
std::string nick;
boost::optional<std::string> password;
- int unreadCount;
+ size_t unreadCount;
boost::filesystem::path avatarPath;
std::map<std::string, JID> impromptuJIDs;
std::map<JID, std::string> inviteesNames;
@@ -107,7 +107,7 @@ namespace Swift {
virtual void removeWhiteboardSession(const JID& jid) = 0;
virtual void removeMUCBookmark(const MUCBookmark& bookmark) = 0;
virtual void setRecents(const std::list<Chat>& recents) = 0;
- virtual void setUnreadCount(int unread) = 0;
+ virtual void setUnreadCount(size_t unread) = 0;
virtual void clearBookmarks() = 0;
virtual void setOnline(bool isOnline) = 0;
diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h
index daece0e..1c36ffc 100644
--- a/Swift/Controllers/UIInterfaces/ChatWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatWindow.h
@@ -202,7 +202,7 @@ namespace Swift {
virtual void setSecurityLabelsEnabled(bool enabled) = 0;
virtual void setCorrectionEnabled(Tristate enabled) = 0;
virtual void setFileTransferEnabled(Tristate enabled) = 0;
- virtual void setUnreadMessageCount(int count) = 0;
+ virtual void setUnreadMessageCount(size_t count) = 0;
virtual void convertToMUC(MUCType mucType) = 0;
// virtual TreeWidget *getTreeWidget() = 0;
virtual void setSecurityLabelsError() = 0;