Closed (fixed)
Project:
Instant messenger
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jan 2005 at 05:49 UTC
Updated:
31 Jan 2005 at 13:15 UTC
When a user has been inactive for more than X minutes they are deemed not present. The IM drop down user selection block then shows zero elements.
I suspect that this is at least one cause of the intermittent log entry:
Location /caa/
Message warning: Invalid argument supplied for foreach() in /home/james/public_html/drupal/includes/common.inc on line 1352.
However I have not done exhaustive testing on this hypothesis and I am unfamiliar with both drupal and PHP.
I hacked my im.module to include:
}
}
+ if (count($items) > 1) {
$form = form_textfield(t('Message'), 'message', $edit['message'], 20, 255);
$form .= form_select(t('Select user'), 'receiver', '', $items);
$form .= form_hidden('destination', $_GET['q']);
$form .= form_submit(t('Go!'));
+ } else {
+ $form = t('No other user online');
+ }
$block['content'] = form($form, 'post', url('im/send'));
}
and the intermittent error I was getting seems to have gone away. I have also discovered it has another benefit in that I now don't get tempted to send messages to myself.
Comments
Comment #1
cubano commentedHi. I remixed your hack to:
while ($uid = db_fetch_object($users)) {
+ if ($user->uid != $uid->uid)
$items[] = array($uid->uid => $uid->name);
}
}
// next line was exchanged with
+ if (count($items) >= 1) {
so I really cannot send messages to myself.
Comment #2
killes@www.drop.org commentedThanks, fixed in cvs.
Comment #3
(not verified) commented