/usr/include/licq/protocolsignal.h is in licq-dev 1.6.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | /*
* This file is part of Licq, an instant messaging client for UNIX.
* Copyright (C) 2010-2011 Licq developers
*
* Licq 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 2 of the License, or
* (at your option) any later version.
*
* Licq 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 Licq; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LICQ_PROTOCOLSIGNAL_H
#define LICQ_PROTOCOLSIGNAL_H
#include <list>
#include <pthread.h>
#include <string>
#include "userid.h"
namespace Licq
{
class ProtocolSignal
{
public:
enum SignalType
{
SignalLogon = 1, // Log on
SignalLogoff = 2, // Log off
SignalChangeStatus = 3, // Change status
SignalAddUser = 4, // Add a contact to list
SignalRemoveUser = 5, // Remove a contact from list
SignalRenameUser = 6, // Rename a contact in server list
SignalChangeUserGroups=7, // Change groups for a user
SignalSendMessage = 8, // Send a message to a user
SignalNotifyTyping = 9, // Send typing notification
SignalGrantAuth = 10, // Grant authorization to a user
SignalRefuseAuth = 11, // Refuse authorization for a user
SignalRequestInfo = 12, // Request user information
SignalUpdateInfo = 13, // Update owner information
SignalRequestPicture= 14, // Request user picture
SignalBlockUser = 15, // Add user to invisible/block list
SignalUnblockUser = 16, // Remove user from inivisible/block list
SignalAcceptUser = 17, // Add user to visible/accept list
SignalUnacceptUser = 18, // Removed user from visible/accept list
SignalIgnoreUser = 19, // Add user to ignore list
SignalUnignoreUser = 20, // Remove user from ignore list
SignalSendFile = 21, // Send file to user
SignalSendChat = 22, // Send chat request
SignalCancelEvent = 23, // Cancel an event (chat, secure, file, etc.)
SignalSendReply = 24, // Accept/refuse file/chat request
SignalOpenedWindow = 25, // Chat window has been opened for a user
SignalClosedWindow = 26, // Chat window has been closed for a user
SignalOpenSecure = 27, // Request secure channel with user
SignalCloseSecure = 28, // Close secure channel with user
SignalRequestAuth = 29, // Request authorization from user
};
// Flags for send events
enum SendFlags
{
SendToList = 1, // Flag a message as low prio (send to contact list)
SendUrgent = 2, // Flag a message as urgent
SendDirect = 4, // Don't send message via server (if supported by protocol)
SendToMultiple = 8, // Message is sent to multiple recipients
};
ProtocolSignal(SignalType signal, const UserId& userId = UserId(), unsigned long eventId = 0)
: mySignal(signal),
myUserId(userId),
myEventId(eventId),
myCallerThread(pthread_self())
{ /* Empty */ }
virtual ~ProtocolSignal()
{ /* Empty */ }
//! The signal is being sent to the plugin.
SignalType signal() const
{ return mySignal; }
//! The user id that this signal is being used for.
const UserId& userId() const
{ return myUserId; }
/// Id to use for event generated by this signal
unsigned long eventId() const
{ return myEventId; }
//! The calling thread.
pthread_t callerThread() const
{ return myCallerThread; }
private:
SignalType mySignal;
UserId myUserId;
unsigned long myEventId;
pthread_t myCallerThread;
};
class ProtoLogonSignal : public ProtocolSignal
{
public:
ProtoLogonSignal(unsigned status)
: ProtocolSignal(SignalLogon),
myStatus(status)
{ /* Empty */ }
//! The requested initial status.
unsigned status() const { return myStatus; }
private:
unsigned myStatus;
};
class ProtoLogoffSignal : public ProtocolSignal
{
public:
ProtoLogoffSignal()
: ProtocolSignal(SignalLogoff)
{ /* Empty */ }
};
class ProtoChangeStatusSignal : public ProtocolSignal
{
public:
ProtoChangeStatusSignal(unsigned status)
: ProtocolSignal(SignalChangeStatus),
myStatus(status)
{ /* Empty */ }
//! The requested status.
unsigned status() const { return myStatus; }
private:
unsigned myStatus;
};
class ProtoAddUserSignal : public ProtocolSignal
{
public:
ProtoAddUserSignal(const UserId& userId, bool authRequired)
: ProtocolSignal(SignalAddUser, userId),
myAuthRequired(authRequired)
{ /* Empty */ }
//! True if authorization is required to add this user.
bool authRequired() const { return myAuthRequired; }
private:
bool myAuthRequired;
};
class ProtoRemoveUserSignal : public ProtocolSignal
{
public:
ProtoRemoveUserSignal(const UserId& userId)
: ProtocolSignal(SignalRemoveUser, userId)
{ /* Empty */ }
};
class ProtoRenameUserSignal : public ProtocolSignal
{
public:
ProtoRenameUserSignal(const UserId& userId)
: ProtocolSignal(SignalRenameUser, userId)
{ /* Empty */ }
};
class ProtoChangeUserGroupsSignal : public ProtocolSignal
{
public:
ProtoChangeUserGroupsSignal(const UserId& userId)
: ProtocolSignal(SignalChangeUserGroups, userId)
{ /* Empty */ }
};
class ProtoSendMessageSignal : public ProtocolSignal
{
public:
ProtoSendMessageSignal(unsigned long eventId, const UserId& userId,
const std::string& message, unsigned flags,
unsigned long convoId = 0)
: ProtocolSignal(SignalSendMessage, userId, eventId),
myMessage(message),
myFlags(flags),
myConvoId(convoId)
{ /* Empty */ }
//! The message to be sent
const std::string& message() const { return myMessage; }
//! The message flags
unsigned flags() const { return myFlags; }
//! The conversation id to use (gets the socket).
unsigned long convoId() const { return myConvoId; }
private:
std::string myMessage;
unsigned myFlags;
unsigned long myConvoId;
};
class ProtoTypingNotificationSignal : public ProtocolSignal
{
public:
ProtoTypingNotificationSignal(const UserId& userId, bool active, unsigned long convoId = 0)
: ProtocolSignal(SignalNotifyTyping, userId),
myActive(active),
myConvoId(convoId)
{ /* Empty */ }
bool active() const { return myActive; }
//! The conversation id to use (gets the socket).
unsigned long convoId() const { return myConvoId; }
private:
bool myActive;
unsigned long myConvoId;
};
class ProtoGrantAuthSignal : public ProtocolSignal
{
public:
ProtoGrantAuthSignal(const UserId& userId, const std::string& message)
: ProtocolSignal(SignalGrantAuth, userId),
myMessage(message)
{ /* Empty */ }
const std::string& message() const { return myMessage; }
private:
std::string myMessage;
};
class ProtoRefuseAuthSignal : public ProtocolSignal
{
public:
ProtoRefuseAuthSignal(const UserId& userId, const std::string& message)
: ProtocolSignal(SignalRefuseAuth, userId),
myMessage(message)
{ /* Empty */ }
const std::string& message() const { return myMessage; }
private:
std::string myMessage;
};
class ProtoRequestInfo : public ProtocolSignal
{
public:
ProtoRequestInfo(const UserId& userId)
: ProtocolSignal(SignalRequestInfo, userId)
{ /* Empty */ }
};
class ProtoUpdateInfoSignal : public ProtocolSignal
{
public:
ProtoUpdateInfoSignal()
: ProtocolSignal(SignalUpdateInfo)
{ /* Empty */ }
};
class ProtoRequestPicture : public ProtocolSignal
{
public:
ProtoRequestPicture(const UserId& userId)
: ProtocolSignal(SignalRequestPicture, userId)
{ /* Empty */ }
};
class ProtoBlockUserSignal : public ProtocolSignal
{
public:
ProtoBlockUserSignal(const UserId& userId)
: ProtocolSignal(SignalBlockUser, userId)
{ /* Empty */ }
};
class ProtoUnblockUserSignal : public ProtocolSignal
{
public:
ProtoUnblockUserSignal(const UserId& userId)
: ProtocolSignal(SignalUnblockUser, userId)
{ /* Empty */ }
};
class ProtoAcceptUserSignal : public ProtocolSignal
{
public:
ProtoAcceptUserSignal(const UserId& userId)
: ProtocolSignal(SignalAcceptUser, userId)
{ /* Empty */ }
};
class ProtoUnacceptUserSignal : public ProtocolSignal
{
public:
ProtoUnacceptUserSignal(const UserId& userId)
: ProtocolSignal(SignalUnacceptUser, userId)
{ /* Empty */ }
};
class ProtoIgnoreUserSignal : public ProtocolSignal
{
public:
ProtoIgnoreUserSignal(const UserId& userId)
: ProtocolSignal(SignalIgnoreUser, userId)
{ /* Empty */ }
};
class ProtoUnignoreUserSignal : public ProtocolSignal
{
public:
ProtoUnignoreUserSignal(const UserId& userId)
: ProtocolSignal(SignalUnignoreUser, userId)
{ /* Empty */ }
};
class ProtoSendFileSignal : public ProtocolSignal
{
public:
ProtoSendFileSignal(unsigned long eventId, const UserId& userId, const std::string& filename,
const std::string& message, const std::list<std::string>& files)
: ProtocolSignal(SignalSendFile, userId, eventId),
myFilename(filename),
myMessage(message),
myFiles(files)
{ /* Empty */ }
const std::string& filename() const { return myFilename; }
const std::string& message() const { return myMessage; }
const std::list<std::string>& files() const { return myFiles; }
private:
std::string myFilename;
std::string myMessage;
std::list<std::string> myFiles;
};
class ProtoSendChatSignal : public ProtocolSignal
{
public:
ProtoSendChatSignal(const UserId& userId, const std::string& message)
: ProtocolSignal(SignalSendChat, userId),
myMessage(message)
{ /* Empty */ }
const std::string& message() const { return myMessage; }
private:
std::string myMessage;
};
class ProtoCancelEventSignal : public ProtocolSignal
{
public:
ProtoCancelEventSignal(const UserId& userId, unsigned long flag)
: ProtocolSignal(SignalCancelEvent, userId),
myFlag(flag)
{ /* Empty */ }
unsigned long flag() const { return myFlag; }
private:
unsigned long myFlag;
};
class ProtoSendEventReplySignal : public ProtocolSignal
{
public:
ProtoSendEventReplySignal(const UserId& userId, const std::string& message,
bool accepted, unsigned short port, unsigned long sequence = 0,
unsigned long flag1 = 0, unsigned long flag2 = 0, bool direct = false)
: ProtocolSignal(SignalSendReply, userId),
myMessage(message),
myAccept(accepted),
myPort(port),
mySequence(sequence),
myFlag1(flag1),
myFlag2(flag2),
myDirect(direct)
{ /* Empty */ }
const std::string& message() const { return myMessage; }
bool accept() const { return myAccept; }
unsigned short port() const { return myPort; }
unsigned long sequence() const { return mySequence; }
unsigned long flag1() const { return myFlag1; }
unsigned long flag2() const { return myFlag2; }
bool direct() const { return myDirect; }
private:
std::string myMessage;
bool myAccept;
unsigned short myPort;
unsigned long mySequence;
unsigned long myFlag1;
unsigned long myFlag2;
bool myDirect;
};
class ProtoOpenedWindowSignal : public ProtocolSignal
{
public:
ProtoOpenedWindowSignal(const UserId& userId)
: ProtocolSignal(SignalOpenedWindow, userId)
{ /* Empty */ }
};
class ProtoClosedWindowSignal : public ProtocolSignal
{
public:
ProtoClosedWindowSignal(const UserId& userId)
: ProtocolSignal(SignalClosedWindow, userId)
{ /* Empty */ }
};
class ProtoOpenSecureSignal : public ProtocolSignal
{
public:
ProtoOpenSecureSignal(unsigned long eventId, const UserId& userId)
: ProtocolSignal(SignalOpenSecure, userId, eventId)
{ /* Empty */ }
};
class ProtoCloseSecureSignal : public ProtocolSignal
{
public:
ProtoCloseSecureSignal(unsigned long eventId, const UserId& userId)
: ProtocolSignal(SignalCloseSecure, userId, eventId)
{ /* Empty */ }
};
class ProtoRequestAuthSignal : public ProtocolSignal
{
public:
ProtoRequestAuthSignal(const UserId& userId, const std::string& message)
: ProtocolSignal(SignalRequestAuth, userId),
myMessage(message)
{ /* Empty */ }
const std::string& message() const { return myMessage; }
private:
std::string myMessage;
};
} // namespace Licq
#endif
|