[ekg2-commit] r4133 - in trunk: ekg plugins/gg plugins/jabber: trunk/ekg/protocol.c trunk/ekg/protocol.h trunk/plugins/gg/gg.c trunk/plugins/jabber/jabber_handlers.c trunk/plugins/jabber/jabber_handlers_tlen.c
SVN commit
svn w toxygen.net
Sob, 19 Lip 2008, 13:30:35 CEST
Author: darkjames
Date: 2008-07-19 13:30:34 +0200 (Sat, 19 Jul 2008)
New Revision: 4133
Modified:
trunk/ekg/protocol.c
trunk/ekg/protocol.h
trunk/plugins/gg/gg.c
trunk/plugins/jabber/jabber_handlers.c
trunk/plugins/jabber/jabber_handlers_tlen.c
Log:
PROTOCOL_MESSAGE_ACK, PROTOCOL_XSTATE.
Modified: trunk/ekg/protocol.c
===================================================================
--- trunk/ekg/protocol.c 2008-07-19 11:08:42 UTC (rev 4132)
+++ trunk/ekg/protocol.c 2008-07-19 11:30:34 UTC (rev 4133)
@@ -902,6 +902,10 @@
return 0;
}
+int protocol_message_ack_emit(const session_t *s, const char *rcpt, const char *seq, int status) {
+ return query_emit_id_ro(NULL, PROTOCOL_MESSAGE_ACK, &(s->uid), &rcpt, &seq, &status);
+}
+
static QUERY(protocol_xstate)
{
/* state contains xstate bits, which should be set, offstate those, which should be cleared */
@@ -943,6 +947,10 @@
return 0;
}
+int protocol_xstate_emit(const session_t *s, const char *uid, int state, int offstate) {
+ return query_emit_id_ro(NULL, PROTOCOL_XSTATE, &(s->uid), &uid, &state, &offstate);
+}
+
/**
* dcc_add()
*
Modified: trunk/ekg/protocol.h
===================================================================
--- trunk/ekg/protocol.h 2008-07-19 11:08:42 UTC (rev 4132)
+++ trunk/ekg/protocol.h 2008-07-19 11:30:34 UTC (rev 4133)
@@ -88,8 +88,10 @@
int protocol_connected_emit(const session_t *s);
int protocol_disconnected_emit(const session_t *s, const char *reason, int type);
+int protocol_message_ack_emit(const session_t *s, const char *rcpt, const char *seq, int status);
int protocol_message_emit(const session_t *s, const char *uid, char **rcpts, const char *text, const uint32_t *format, time_t sent, int class, const char *seq, int dobeep, int secure);
int protocol_status_emit(const session_t *s, const char *uid, int status, char *descr, time_t when);
+int protocol_xstate_emit(const session_t *s, const char *uid, int state, int offstate);
#endif
Modified: trunk/plugins/gg/gg.c
===================================================================
--- trunk/plugins/gg/gg.c 2008-07-19 11:08:42 UTC (rev 4132)
+++ trunk/plugins/gg/gg.c 2008-07-19 11:30:34 UTC (rev 4133)
@@ -1022,7 +1022,6 @@
*/
static void gg_session_handler_ack(session_t *s, struct gg_event *e) {
- char *__session = xstrdup(s->uid);
char *__rcpt = saprintf("gg:%d", e->event.ack.recipient);
char *__seq = xstrdup(itoa(e->event.ack.seq));
int __status;
@@ -1057,11 +1056,10 @@
__status = EKG_ACK_UNKNOWN;
break;
}
- query_emit_id(NULL, PROTOCOL_MESSAGE_ACK, &__session, &__rcpt, &__seq, &__status);
+ protocol_message_ack_emit(s, __rcpt, __seq, __status);
xfree(__seq);
xfree(__rcpt);
- xfree(__session);
}
/*
Modified: trunk/plugins/jabber/jabber_handlers.c
===================================================================
--- trunk/plugins/jabber/jabber_handlers.c 2008-07-19 11:08:42 UTC (rev 4132)
+++ trunk/plugins/jabber/jabber_handlers.c 2008-07-19 11:30:34 UTC (rev 4133)
@@ -762,17 +762,8 @@
return;
} /* <error> */
- if (j->istlen) { /* disable typing notify, tlen protocol doesn't send info about it (?) XXX */
- char *session = xstrdup(session_uid_get(s));
- char *rcpt = xstrdup(uid);
- int state = 0;
- int stateo = EKG_XSTATE_TYPING;
-
- query_emit_id(NULL, PROTOCOL_XSTATE, &session, &rcpt, &state, &stateo);
-
- xfree(session);
- xfree(rcpt);
- }
+ if (j->istlen) /* disable typing notify, tlen protocol doesn't send info about it (?) XXX */
+ protocol_xstate_emit(s, uid, 0, EKG_XSTATE_TYPING);
body = string_init("");
@@ -825,17 +816,10 @@
}
/* jeśli body nie ma, to odpowiedz na nasza prosbe */
if (!nbody && isack) {
- char *__session = xstrdup(session_uid_get(s));
- char *__rcpt = xstrdup(uid);
int __status = ((acktype & 1) ? EKG_ACK_DELIVERED :
(acktype & 2) ? EKG_ACK_QUEUED :
EKG_ACK_UNKNOWN);
- char *__seq = NULL; /* id ? */
- /* protocol_message_ack; sesja ; uid ; seq (NULL ? ) ; status - delivered ; queued ) */
- query_emit_id(NULL, PROTOCOL_MESSAGE_ACK, &__session, &__rcpt, &__seq, &__status);
- xfree(__session);
- xfree(__rcpt);
- /* xfree(__seq); */
+ protocol_message_ack_emit(s, uid, NULL, __status);
}
if (!(composing & 2)) /* '& 2' means we've already got chatstate (higher prio) */
@@ -981,15 +965,10 @@
* 3rd bit determines whether the <composing/> is on
*/
if (composing) {
- char *__session = xstrdup(session_uid_get(s));
- char *__rcpt = xstrdup(uid);
int state = (!nbody && (composing & 4) ? EKG_XSTATE_TYPING : 0);
int stateo = (!state ? EKG_XSTATE_TYPING : 0);
- query_emit_id(NULL, PROTOCOL_XSTATE, &__session, &__rcpt, &state, &stateo);
-
- xfree(__session);
- xfree(__rcpt);
+ protocol_xstate_emit(s, uid, state, stateo);
}
if (nbody || nsubject) {
Modified: trunk/plugins/jabber/jabber_handlers_tlen.c
===================================================================
--- trunk/plugins/jabber/jabber_handlers_tlen.c 2008-07-19 11:08:42 UTC (rev 4132)
+++ trunk/plugins/jabber/jabber_handlers_tlen.c 2008-07-19 11:30:34 UTC (rev 4133)
@@ -19,13 +19,10 @@
char *uid = saprintf("tlen:%s", from);
/* typing notification */
- char *session = xstrdup(session_uid_get(s));
- int stateo = !xstrcmp(type, "u") ? EKG_XSTATE_TYPING : 0;
- int state = !stateo ? EKG_XSTATE_TYPING : 0;
-
- query_emit_id(NULL, PROTOCOL_XSTATE, &session, &uid, &state, &stateo);
-
- xfree(session);
+ if (!xstrcmp(type, "u"))
+ protocol_xstate_emit(s, uid, 0, EKG_XSTATE_TYPING);
+ else
+ protocol_xstate_emit(s, uid, EKG_XSTATE_TYPING, 0);
xfree(uid);
return;
}
Więcej informacji o liście dyskusyjnej ekg2-commit