view plugins/icq/chatsession.c @ 1309:0a766047b4fd

[gaim-migrate @ 1319] Yay, new icqlib committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 19 Dec 2000 10:08:29 +0000
parents 201ec77f3a60
children 4c510ca3563f
line wrap: on
line source


#include <stdlib.h>

#include "icqlib.h"
#include "chatsession.h"
#include "list.h"

icq_ChatSession *icq_ChatSessionNew(ICQLINK *icqlink) 
{
  icq_ChatSession *p=(icq_ChatSession *)malloc(sizeof(icq_ChatSession));

  if (p)
  {
    p->remote_handle=0L;
    p->status=0;
    p->id=0L;
    p->icqlink=icqlink;
    list_insert(icqlink->d->icq_ChatSessions, 0, p);
  }
	
  return p;
}

void icq_ChatSessionDelete(void *p)
{
  free(p);
}

void icq_ChatSessionClose(icq_ChatSession *p)
{
  list_remove(p->icqlink->d->icq_ChatSessions, p);
  icq_ChatSessionDelete(p);
}

int _icq_FindChatSession(void *p, va_list data)
{
  DWORD uin=va_arg(data, DWORD);
  return (((icq_ChatSession *)p)->remote_uin == uin);
}

icq_ChatSession *icq_FindChatSession(ICQLINK *icqlink, DWORD uin)
{
  return list_traverse(icqlink->d->icq_ChatSessions,
    _icq_FindChatSession, uin);
}

void icq_ChatSessionSetStatus(icq_ChatSession *p, int status)
{
  p->status=status;
  if(p->id)
    if(p->icqlink->icq_RequestNotify)
      (*p->icqlink->icq_RequestNotify)(p->icqlink, p->id, ICQ_NOTIFY_CHAT, status, 0);
}