From 0af5907110e6e116b7b6d7f93c9b10ed52586975 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 18 Oct 2003 20:19:22 +0000 Subject: [PATCH] Implemented changes from latest presence-attrs draft. --- CHANGES | 4 +++ apps/irssi/src/silc/core/silc-queries.c | 4 +++ lib/silccore/silcattrs.h | 48 +++++++++++++++---------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 6a9fd9f8..3b6ab18e 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,10 @@ Sat Oct 18 11:55:33 EEST 2003 Pekka Riikonen Affected files lib/silcutil/silcsockconn.[ch], unix/silcunixsockconn.c. + * Implemented latest presence-attrs draft changes. Affected + files lib/silccore/silcattrs.h and + irssi/src/silc/core/silc-queries.c. + Tue Oct 14 18:24:53 EEST 2003 Pekka Riikonen * Save old channel keys in list to allow more rapid change diff --git a/apps/irssi/src/silc/core/silc-queries.c b/apps/irssi/src/silc/core/silc-queries.c index 9daff3b0..fa721488 100644 --- a/apps/irssi/src/silc/core/silc-queries.c +++ b/apps/irssi/src/silc/core/silc-queries.c @@ -433,6 +433,8 @@ void silc_query_attributes_default(SilcClient client, mask |= SILC_ATTRIBUTE_CONTACT_MMS; if (!strcasecmp(*entry, "CHAT")) mask |= SILC_ATTRIBUTE_CONTACT_CHAT; + if (!strcasecmp(*entry, "VIDEO")) + mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; } silc_client_attribute_add(silc_client, conn, SILC_ATTRIBUTE_PREFERRED_CONTACT, (void *)mask, @@ -702,6 +704,8 @@ void silc_query_attributes_print(SILC_SERVER_REC *server, silc_strncat(tmp, sizeof(tmp), "SMS ", strlen(" SMS")); if (mask & SILC_ATTRIBUTE_CONTACT_MMS) silc_strncat(tmp, sizeof(tmp), "MMS ", strlen(" MMS")); + if (mask & SILC_ATTRIBUTE_CONTACT_VIDEO) + silc_strncat(tmp, sizeof(tmp), "VIDEO ", strlen(" VIDEO")); printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP, SILCTXT_ATTR_PREFERRED_CONTACT, tmp); } diff --git a/lib/silccore/silcattrs.h b/lib/silccore/silcattrs.h index afcc0194..d8e724ae 100644 --- a/lib/silccore/silcattrs.h +++ b/lib/silccore/silcattrs.h @@ -1,10 +1,10 @@ /* - silcattrs.h + silcattrs.h Author: Pekka Riikonen - Copyright (C) 2002 Pekka Riikonen + Copyright (C) 2002 - 2003 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ /****s* silccore/SilcAttributesAPI/SilcAttributePayload * * NAME - * + * * typedef struct SilcAttributePayloadStruct *SilcAttributePayload; * * DESCRIPTION @@ -49,7 +49,7 @@ typedef struct SilcAttributePayloadStruct *SilcAttributePayload; /****d* silccore/SilcAttributesAPI/SilcAttribute * * NAME - * + * * typedef SilcUInt8 SilcAttribute; * * DESCRIPTION @@ -90,7 +90,7 @@ typedef SilcUInt8 SilcAttribute; /****d* silccore/SilcAttributesAPI/SilcAttributeFlags * * NAME - * + * * typedef SilcUInt8 SilcAttributeFlags; * * DESCRIPTION @@ -110,7 +110,7 @@ typedef SilcUInt8 SilcAttributeFlags; /****d* silccore/SilcAttributesAPI/SilcAttributeMood * * NAME - * + * * typedef enum { ... } SilcAttributeMood; * * DESCRIPTION @@ -139,7 +139,7 @@ typedef enum { /****d* silccore/SilcAttributesAPI/SilcAttributeContact * * NAME - * + * * typedef enum { ... } SilcAttributeContact; * * DESCRIPTION @@ -157,13 +157,14 @@ typedef enum { SILC_ATTRIBUTE_CONTACT_SMS = 0x00000008, /* SMS preferred */ SILC_ATTRIBUTE_CONTACT_MMS = 0x00000010, /* MMS preferred */ SILC_ATTRIBUTE_CONTACT_CHAT = 0x00000020, /* chatting preferred */ + SILC_ATTRIBUTE_CONTACT_VIDEO = 0x00000040, /* video conferencing */ } SilcAttributeContact; /***/ /****d* silccore/SilcAttributesAPI/SilcAttributeDevice * * NAME - * + * * typedef enum { ... } SilcAttributeDevice; * * DESCRIPTION @@ -379,7 +380,7 @@ unsigned char *silc_attribute_get_verify_data(SilcDList attrs, /****s* silccore/SilcAttributesAPI/SilcAttributeObjService * * NAME - * + * * typedef struct { ... } SilcAttributeObjService; * * DESCRIPTION @@ -388,7 +389,7 @@ unsigned char *silc_attribute_get_verify_data(SilcDList attrs, * * SOURCE */ -typedef struct { +typedef struct SilcAttributeObjServiceStruct { SilcUInt32 port; /* IANA specified service port */ SilcUInt32 idle; /* Idle time in the service */ char signon[64]; /* Signon date and time (UTC) */ @@ -400,7 +401,7 @@ typedef struct { /****s* silccore/SilcAttributesAPI/SilcAttributeObjMime * * NAME - * + * * typedef struct { ... } SilcAttributeObjMime; * * DESCRIPTION @@ -410,7 +411,7 @@ typedef struct { * * SOURCE */ -typedef struct { +typedef struct SilcAttributeObjMimeStruct { const unsigned char *mime; /* MIME buffer */ SilcUInt32 mime_len; /* length of the MIME buffer */ } SilcAttributeObjMime; @@ -419,7 +420,7 @@ typedef struct { /****s* silccore/SilcAttributesAPI/SilcAttributeObjGeo * * NAME - * + * * typedef struct { ... } SilcAttributeObjGeo; * * DESCRIPTION @@ -429,7 +430,7 @@ typedef struct { * * SOURCE */ -typedef struct { +typedef struct SilcAttributeObjGeoStruct { char *longitude; /* Longitude */ char *latitude; /* Latitude */ char *altitude; /* Altitude */ @@ -440,7 +441,7 @@ typedef struct { /****s* silccore/SilcAttributesAPI/SilcAttributeObjDevice * * NAME - * + * * typedef struct { ... } SilcAttributeObjDevice; * * DESCRIPTION @@ -450,7 +451,7 @@ typedef struct { * * SOURCE */ -typedef struct { +typedef struct SilcAttributeObjDeviceStruct { SilcAttributeDevice type; /* device type */ char *manufacturer; /* manufacturer of the device */ char *version; /* device version string */ @@ -462,7 +463,7 @@ typedef struct { /****s* silccore/SilcAttributesAPI/SilcAttributeObjPk * * NAME - * + * * typedef struct { ... } SilcAttributeObjPk; * * DESCRIPTION @@ -472,7 +473,7 @@ typedef struct { * * SOURCE */ -typedef struct { +typedef struct SilcAttributeObjPkStruct { char *type; /* public key/certificate type, NULL when contains digital signature. */ unsigned char *data; /* public key/cert/signature data. The @@ -502,6 +503,17 @@ typedef struct { * You can use silc_attribute_get_attribute to get the SilcAttribute * type from the `payload'. * + * EXAMPLE + * + * SilcAttributeObjDevice dev; + * + * ... + * case SILC_ATTRIBUTE_DEVICE_INFO: + * memset(&dev, 0, sizeof(dev)); + * if (!silc_attribute_get_object(payload, (void *)&dev, sizeof(dev))) + * error(); + * ... + * ***/ bool silc_attribute_get_object(SilcAttributePayload payload, void *object, SilcUInt32 object_size); -- 2.43.0