Mercurial > pidgin
comparison src/protocols/oscar/conn.c @ 8866:c2dff943e240
[gaim-migrate @ 9634]
(14:10:22) Faceprint: the timestamp plugin will now mislead users
(14:10:54) Me: which way does ichat behave?
(14:10:58) Me: i think the new way
(14:11:05) Me: but its been some time since i've seen it
(14:11:09) Faceprint: i don't know or care, the new behavior will confuse
the hell out of people
(14:11:22) Faceprint: lets say we have a conversation
(14:11:25) Faceprint: 2:00 gets printed by the plugin
(14:11:36) Faceprint: then we say nothing for 3 hours
(14:11:42) Faceprint: and then one of us says something
(14:12:04) Faceprint: that will be printed, and then as many as 5 minutes
later, the plugin will print 5:05
(14:12:23) Me: yes yes yes, i see both sides of this one. i tend to think
the new behavior is better, but i'll revert it
(14:12:36) Faceprint: since "normal" timestamps are turned off, it appears
as though what was just said was said around 2
(14:12:43) Faceprint: no, don't revert, fix
(14:12:53) Faceprint: preferably, make the patch writer fix
(14:12:57) Me: *nods*
(14:13:06) Me: which requires reverting since otherwise he won't be
motivated
(14:13:13) Faceprint: if something is said and we've gone more than 5 min
w/o printing a timestamp, print a timestamp before writing to the conv
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 03 May 2004 18:13:39 +0000 |
parents | 92cbf9713795 |
children | ec3e041dc3bd |
comparison
equal
deleted
inserted
replaced
8865:12791b1a13ee | 8866:c2dff943e240 |
---|---|
239 return; | 239 return; |
240 } | 240 } |
241 | 241 |
242 /** | 242 /** |
243 * aim_conn_getnext - Gets a new connection structure. | 243 * aim_conn_getnext - Gets a new connection structure. |
244 * @sess: Session | |
245 * | 244 * |
246 * Allocate a new empty connection structure. | 245 * Allocate a new empty connection structure. |
247 * | 246 * |
247 * @param sess Session | |
248 * @return Returns new connection structure | |
248 */ | 249 */ |
249 static aim_conn_t *aim_conn_getnext(aim_session_t *sess) | 250 static aim_conn_t *aim_conn_getnext(aim_session_t *sess) |
250 { | 251 { |
251 aim_conn_t *newconn; | 252 aim_conn_t *newconn; |
252 | 253 |
268 return newconn; | 269 return newconn; |
269 } | 270 } |
270 | 271 |
271 /** | 272 /** |
272 * aim_conn_kill - Close and free a connection. | 273 * aim_conn_kill - Close and free a connection. |
273 * @sess: Session for the connection | |
274 * @deadconn: Connection to be freed | |
275 * | 274 * |
276 * Close, clear, and free a connection structure. Should never be | 275 * Close, clear, and free a connection structure. Should never be |
277 * called from within libfaim. | 276 * called from within libfaim. |
278 * | 277 * |
278 * @param sess Session for the connection | |
279 * @param deadconn Connection to be freed | |
279 */ | 280 */ |
280 faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn) | 281 faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn) |
281 { | 282 { |
282 aim_conn_t *cur, **prev; | 283 aim_conn_t *cur, **prev; |
283 | 284 |
300 return; | 301 return; |
301 } | 302 } |
302 | 303 |
303 /** | 304 /** |
304 * aim_conn_close - Close a connection | 305 * aim_conn_close - Close a connection |
305 * @deadconn: Connection to close | |
306 * | 306 * |
307 * Close (but not free) a connection. | 307 * Close (but not free) a connection. |
308 * | 308 * |
309 * This leaves everything untouched except for clearing the | 309 * This leaves everything untouched except for clearing the |
310 * handler list and setting the fd to -1 (used to recognize | 310 * handler list and setting the fd to -1 (used to recognize |
311 * dead connections). It will also remove cookies if necessary. | 311 * dead connections). It will also remove cookies if necessary. |
312 * | 312 * |
313 * @param deadconn Connection to close | |
313 */ | 314 */ |
314 faim_export void aim_conn_close(aim_conn_t *deadconn) | 315 faim_export void aim_conn_close(aim_conn_t *deadconn) |
315 { | 316 { |
316 aim_rxcallback_t userfunc; | 317 aim_rxcallback_t userfunc; |
317 | 318 |
329 return; | 330 return; |
330 } | 331 } |
331 | 332 |
332 /** | 333 /** |
333 * aim_getconn_type - Find a connection of a specific type | 334 * aim_getconn_type - Find a connection of a specific type |
334 * @sess: Session to search | |
335 * @type: Type of connection to look for | |
336 * | 335 * |
337 * Searches for a connection of the specified type in the | 336 * Searches for a connection of the specified type in the |
338 * specified session. Returns the first connection of that | 337 * specified session. |
339 * type found. | |
340 * | 338 * |
341 * XXX except for RENDEZVOUS, all uses of this should be removed and | 339 * XXX except for RENDEZVOUS, all uses of this should be removed and |
342 * use aim_conn_findbygroup() instead. | 340 * use aim_conn_findbygroup() instead. |
341 * | |
342 * @param sess Session to search | |
343 * @param type Type of connection to look for | |
344 * @return Returns the first connection found of target type | |
343 */ | 345 */ |
344 faim_export aim_conn_t *aim_getconn_type(aim_session_t *sess, int type) | 346 faim_export aim_conn_t *aim_getconn_type(aim_session_t *sess, int type) |
345 { | 347 { |
346 aim_conn_t *cur; | 348 aim_conn_t *cur; |
347 | 349 |
379 return cur; | 381 return cur; |
380 } | 382 } |
381 | 383 |
382 /** | 384 /** |
383 * aim_proxyconnect - An extrememly quick and dirty SOCKS5 interface. | 385 * aim_proxyconnect - An extrememly quick and dirty SOCKS5 interface. |
384 * @sess: Session to connect | |
385 * @host: Host to connect to | |
386 * @port: Port to connect to | |
387 * @statusret: Return value of the connection | |
388 * | 386 * |
389 * Attempts to connect to the specified host via the configured | 387 * Attempts to connect to the specified host via the configured |
390 * proxy settings, if present. If no proxy is configured for | 388 * proxy settings, if present. If no proxy is configured for |
391 * this session, the connection is done directly. | 389 * this session, the connection is done directly. |
392 * | 390 * |
393 * XXX this is really awful. | 391 * XXX this is really awful. |
394 * | 392 * |
393 * @param sess Session to connect | |
394 * @param host Host to connect to | |
395 * @param port Port to connect to | |
396 * @param statusret Return value of the connection | |
395 */ | 397 */ |
396 static int aim_proxyconnect(aim_session_t *sess, const char *host, fu16_t port, fu32_t *statusret) | 398 static int aim_proxyconnect(aim_session_t *sess, const char *host, fu16_t port, fu32_t *statusret) |
397 { | 399 { |
398 int fd = -1; | 400 int fd = -1; |
399 | 401 |
547 return fd; | 549 return fd; |
548 } | 550 } |
549 | 551 |
550 /** | 552 /** |
551 * aim_cloneconn - clone an aim_conn_t | 553 * aim_cloneconn - clone an aim_conn_t |
552 * @sess: session containing parent | |
553 * @src: connection to clone | |
554 * | 554 * |
555 * A new connection is allocated, and the values are filled in | 555 * A new connection is allocated, and the values are filled in |
556 * appropriately. Note that this function sets the new connnection's | 556 * appropriately. Note that this function sets the new connnection's |
557 * ->priv pointer to be equal to that of its parent: only the pointer | 557 * ->priv pointer to be equal to that of its parent: only the pointer |
558 * is copied, not the data it points to. | 558 * is copied, not the data it points to. |
559 * | 559 * |
560 * This function returns a pointer to the new aim_conn_t, or %NULL on | 560 * @param sess session containing parent |
561 * error | 561 * @param src connection to clone |
562 * @return Returns a pointer to the new aim_conn_t, or %NULL on error | |
562 */ | 563 */ |
563 faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src) | 564 faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src) |
564 { | 565 { |
565 aim_conn_t *conn; | 566 aim_conn_t *conn; |
566 | 567 |
591 return conn; | 592 return conn; |
592 } | 593 } |
593 | 594 |
594 /** | 595 /** |
595 * aim_newconn - Open a new connection | 596 * aim_newconn - Open a new connection |
596 * @sess: Session to create connection in | |
597 * @type: Type of connection to create | |
598 * @dest: Host to connect to (in "host:port" syntax) | |
599 * | 597 * |
600 * Opens a new connection to the specified dest host of specified | 598 * Opens a new connection to the specified dest host of specified |
601 * type, using the proxy settings if available. If @host is %NULL, | 599 * type, using the proxy settings if available. If @host is %NULL, |
602 * the connection is allocated and returned, but no connection | 600 * the connection is allocated and returned, but no connection |
603 * is made. | 601 * is made. |
604 * | 602 * |
605 * FIXME: Return errors in a more sane way. | 603 * FIXME: Return errors in a more sane way. |
606 * | 604 * |
605 * @param sess Session to create connection in | |
606 * @param type Type of connection to create | |
607 * @param dest Host to connect to (in "host:port" syntax) | |
607 */ | 608 */ |
608 faim_export aim_conn_t *aim_newconn(aim_session_t *sess, int type, const char *dest) | 609 faim_export aim_conn_t *aim_newconn(aim_session_t *sess, int type, const char *dest) |
609 { | 610 { |
610 aim_conn_t *connstruct; | 611 aim_conn_t *connstruct; |
611 fu16_t port = FAIM_LOGIN_PORT; | 612 fu16_t port = FAIM_LOGIN_PORT; |
657 return connstruct; | 658 return connstruct; |
658 } | 659 } |
659 | 660 |
660 /** | 661 /** |
661 * aim_conngetmaxfd - Return the highest valued file discriptor in session | 662 * aim_conngetmaxfd - Return the highest valued file discriptor in session |
662 * @sess: Session to search | 663 * |
663 * | 664 * @param sess Session to search |
664 * Returns the highest valued filed descriptor of all open | 665 * @return Returns the highest values file descriptor of |
665 * connections in @sess. | 666 * all open connections in @sess |
666 * | |
667 */ | 667 */ |
668 faim_export int aim_conngetmaxfd(aim_session_t *sess) | 668 faim_export int aim_conngetmaxfd(aim_session_t *sess) |
669 { | 669 { |
670 int j; | 670 int j; |
671 aim_conn_t *cur; | 671 aim_conn_t *cur; |
677 | 677 |
678 return j; | 678 return j; |
679 } | 679 } |
680 | 680 |
681 /** | 681 /** |
682 * aim_conn_in_sess - Predicate to test the precense of a connection in a sess | 682 * aim_conn_in_sess - Predicate to test the presense of a connection in a sess |
683 * @sess: Session to look in | 683 * |
684 * @conn: Connection to look for | 684 * Searches @sess for the passed connection. |
685 * | 685 * |
686 * Searches @sess for the passed connection. Returns 1 if its present, | 686 * @param sess Session to look in |
687 * zero otherwise. | 687 * @param conn Connection to look for |
688 * | 688 * @return Returns 1 if the passed connection is present, zero otherwise |
689 */ | 689 */ |
690 faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn) | 690 faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn) |
691 { | 691 { |
692 aim_conn_t *cur; | 692 aim_conn_t *cur; |
693 | 693 |
699 return 0; | 699 return 0; |
700 } | 700 } |
701 | 701 |
702 /** | 702 /** |
703 * aim_select - Wait for a socket with data or timeout | 703 * aim_select - Wait for a socket with data or timeout |
704 * @sess: Session to wait on | |
705 * @timeout: How long to wait | |
706 * @status: Return status | |
707 * | 704 * |
708 * Waits for a socket with data or for timeout, whichever comes first. | 705 * Waits for a socket with data or for timeout, whichever comes first. |
709 * See select(2). | 706 * See select(2). |
710 * | 707 * |
711 * Return codes in *status: | 708 * Return codes in *status: |
712 * -1 error in select() (%NULL returned) | 709 * -1 error in select() (%NULL returned) |
713 * 0 no events pending (%NULL returned) | 710 * 0 no events pending (%NULL returned) |
714 * 1 outgoing data pending (%NULL returned) | 711 * 1 outgoing data pending (%NULL returned) |
715 * 2 incoming data pending (connection with pending data returned) | 712 * 2 incoming data pending (connection with pending data returned) |
716 * | 713 * |
714 * @param sess Session to wait on | |
715 * @param timeout How long to wait | |
716 * @param status Return status | |
717 * @return If @status is 2, returns connection with pending data, otherwise %NULL | |
717 */ | 718 */ |
718 faim_export aim_conn_t *aim_select(aim_session_t *sess, struct timeval *timeout, int *status) | 719 faim_export aim_conn_t *aim_select(aim_session_t *sess, struct timeval *timeout, int *status) |
719 { | 720 { |
720 aim_conn_t *cur; | 721 aim_conn_t *cur; |
721 fd_set fds, wfds; | 722 fd_set fds, wfds; |
781 return NULL; /* no waiting or error, return */ | 782 return NULL; /* no waiting or error, return */ |
782 } | 783 } |
783 | 784 |
784 /** | 785 /** |
785 * aim_conn_setlatency - Set a forced latency value for connection | 786 * aim_conn_setlatency - Set a forced latency value for connection |
786 * @conn: Conn to set latency for | |
787 * @newval: Number of seconds to force between transmits | |
788 * | 787 * |
789 * Causes @newval seconds to be spent between transmits on a connection. | 788 * Causes @newval seconds to be spent between transmits on a connection. |
790 * | 789 * |
791 * This is my lame attempt at overcoming not understanding the rate | 790 * This is my lame attempt at overcoming not understanding the rate |
792 * limiting. | 791 * limiting. |
793 * | 792 * |
794 * XXX: This should really be replaced with something that scales and | 793 * XXX: This should really be replaced with something that scales and |
795 * backs off like the real rate limiting does. | 794 * backs off like the real rate limiting does. |
796 * | 795 * |
796 * @param conn Conn to set latency for | |
797 * @param newval Number of seconds to force between transmits | |
798 * @return Returns -1 if the connection does not exist, zero otherwise | |
797 */ | 799 */ |
798 faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval) | 800 faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval) |
799 { | 801 { |
800 | 802 |
801 if (!conn) | 803 if (!conn) |
807 return 0; | 809 return 0; |
808 } | 810 } |
809 | 811 |
810 /** | 812 /** |
811 * aim_setupproxy - Configure a proxy for this session | 813 * aim_setupproxy - Configure a proxy for this session |
812 * @sess: Session to set proxy for | |
813 * @server: SOCKS server | |
814 * @username: SOCKS username | |
815 * @password: SOCKS password | |
816 * | 814 * |
817 * Call this with your SOCKS5 proxy server parameters before | 815 * Call this with your SOCKS5 proxy server parameters before |
818 * the first call to aim_newconn(). If called with all %NULL | 816 * the first call to aim_newconn(). If called with all %NULL |
819 * args, it will clear out a previously set proxy. | 817 * args, it will clear out a previously set proxy. |
820 * | 818 * |
821 * Set username and password to %NULL if not applicable. | 819 * Set username and password to %NULL if not applicable. |
822 * | 820 * |
821 * @param sess Session to set proxy for | |
822 * @param server SOCKS server | |
823 * @param username SOCKS username | |
824 * @param password SOCKS password | |
823 */ | 825 */ |
824 faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password) | 826 faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password) |
825 { | 827 { |
826 /* clear out the proxy info */ | 828 /* clear out the proxy info */ |
827 if (!server || !strlen(server)) { | 829 if (!server || !strlen(server)) { |
927 return; | 929 return; |
928 } | 930 } |
929 | 931 |
930 /** | 932 /** |
931 * aim_session_kill - Deallocate a session | 933 * aim_session_kill - Deallocate a session |
932 * @sess: Session to kill | 934 * |
933 * | 935 * @param sess Session to kill |
934 */ | 936 */ |
935 faim_export void aim_session_kill(aim_session_t *sess) | 937 faim_export void aim_session_kill(aim_session_t *sess) |
936 { | 938 { |
937 aim_cleansnacs(sess, -1); | 939 aim_cleansnacs(sess, -1); |
938 | 940 |
943 return; | 945 return; |
944 } | 946 } |
945 | 947 |
946 /** | 948 /** |
947 * aim_setdebuggingcb - Set the function to call when outputting debugging info | 949 * aim_setdebuggingcb - Set the function to call when outputting debugging info |
948 * @sess: Session to change | |
949 * @cb: Function to call | |
950 * | 950 * |
951 * The function specified is called whenever faimdprintf() is used within | 951 * The function specified is called whenever faimdprintf() is used within |
952 * libfaim, and the session's debugging level is greater tha nor equal to | 952 * libfaim, and the session's debugging level is greater tha nor equal to |
953 * the value faimdprintf was called with. | 953 * the value faimdprintf was called with. |
954 * | 954 * |
955 * @param sess Session to change | |
956 * @param cb Function to call | |
957 * @return Returns -1 if the session does not exist, zero otherwise | |
955 */ | 958 */ |
956 faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t cb) | 959 faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t cb) |
957 { | 960 { |
958 | 961 |
959 if (!sess) | 962 if (!sess) |
964 return 0; | 967 return 0; |
965 } | 968 } |
966 | 969 |
967 /** | 970 /** |
968 * aim_conn_isconnecting - Determine if a connection is connecting | 971 * aim_conn_isconnecting - Determine if a connection is connecting |
969 * @conn: Connection to examine | 972 * |
970 * | 973 * @param conn Connection to examine |
971 * Returns nonzero if the connection is in the process of | 974 * @return Returns nonzero if the connection is in the process of |
972 * connecting (or if it just completed and aim_conn_completeconnect() | 975 * connecting (or if it just completed and |
973 * has yet to be called on it). | 976 * aim_conn_completeconnect() has yet to be called on it). |
974 * | |
975 */ | 977 */ |
976 faim_export int aim_conn_isconnecting(aim_conn_t *conn) | 978 faim_export int aim_conn_isconnecting(aim_conn_t *conn) |
977 { | 979 { |
978 | 980 |
979 if (!conn) | 981 if (!conn) |